Yet more purging of `unsigned` type
authorErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 14 Jan 2017 19:47:51 +0000 (06:47 +1100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Sat, 14 Jan 2017 22:48:42 +0000 (09:48 +1100)
22 files changed:
examples/cpp/decode/file/main.cpp
examples/cpp/encode/file/main.cpp
include/FLAC++/decoder.h
include/FLAC++/encoder.h
include/FLAC++/metadata.h
src/flac/analyze.c
src/flac/decode.c
src/flac/encode.c
src/flac/foreign_metadata.c
src/flac/main.c
src/flac/utils.c
src/flac/vorbiscomment.c
src/libFLAC++/metadata.cpp
src/libFLAC++/stream_decoder.cpp
src/libFLAC++/stream_encoder.cpp
src/libFLAC/include/private/bitreader.h
src/libFLAC/include/private/bitwriter.h
src/test_libFLAC++/decoders.cpp
src/test_libFLAC++/encoders.cpp
src/test_libFLAC++/metadata_manip.cpp
src/test_libFLAC++/metadata_object.cpp
src/utils/flactimer/main.cpp

index 61c8078..02a6339 100644 (file)
@@ -36,9 +36,9 @@
 #include "share/compat.h"
 
 static FLAC__uint64 total_samples = 0;
-static unsigned sample_rate = 0;
-static unsigned channels = 0;
-static unsigned bps = 0;
+static uint32_t sample_rate = 0;
+static uint32_t channels = 0;
+static uint32_t bps = 0;
 
 static bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
 {
index d7fc0eb..7d44b87 100644 (file)
@@ -43,12 +43,12 @@ class OurEncoder: public FLAC::Encoder::File {
 public:
        OurEncoder(): FLAC::Encoder::File() { }
 protected:
-       virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate);
+       virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate);
 };
 
 #define READSIZE 1024
 
-static unsigned total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
+static uint32_t total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
 static FLAC__byte buffer[READSIZE/*samples*/ * 2/*bytes_per_sample*/ * 2/*channels*/]; /* we read the WAVE data into here */
 static FLAC__int32 pcm[READSIZE/*samples*/ * 2/*channels*/];
 
@@ -60,9 +60,9 @@ int main(int argc, char *argv[])
        FLAC__StreamMetadata *metadata[2];
        FLAC__StreamMetadata_VorbisComment_Entry entry;
        FILE *fin;
-       unsigned sample_rate = 0;
-       unsigned channels = 0;
-       unsigned bps = 0;
+       uint32_t sample_rate = 0;
+       uint32_t channels = 0;
+       uint32_t bps = 0;
 
        if(argc != 3) {
                fprintf(stderr, "usage: %s infile.wav outfile.flac\n", argv[0]);
@@ -85,10 +85,10 @@ int main(int argc, char *argv[])
                fclose(fin);
                return 1;
        }
-       sample_rate = ((((((unsigned)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24];
+       sample_rate = ((((((uint32_t)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24];
        channels = 2;
        bps = 16;
-       total_samples = (((((((unsigned)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4;
+       total_samples = (((((((uint32_t)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4;
 
        /* check the encoder */
        if(!encoder) {
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
        return 0;
 }
 
-void OurEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate)
+void OurEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate)
 {
        fprintf(stderr, "wrote %" PRIu64 " bytes, %" PRIu64 "/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate);
 }
index 0b93906..7de7e59 100644 (file)
@@ -135,11 +135,11 @@ namespace FLAC {
                        State get_state() const;                                          ///< See FLAC__stream_decoder_get_state()
                        virtual bool get_md5_checking() const;                            ///< See FLAC__stream_decoder_get_md5_checking()
                        virtual FLAC__uint64 get_total_samples() const;                   ///< See FLAC__stream_decoder_get_total_samples()
-                       virtual unsigned get_channels() const;                            ///< See FLAC__stream_decoder_get_channels()
+                       virtual uint32_t get_channels() const;                            ///< See FLAC__stream_decoder_get_channels()
                        virtual ::FLAC__ChannelAssignment get_channel_assignment() const; ///< See FLAC__stream_decoder_get_channel_assignment()
-                       virtual unsigned get_bits_per_sample() const;                     ///< See FLAC__stream_decoder_get_bits_per_sample()
-                       virtual unsigned get_sample_rate() const;                         ///< See FLAC__stream_decoder_get_sample_rate()
-                       virtual unsigned get_blocksize() const;                           ///< See FLAC__stream_decoder_get_blocksize()
+                       virtual uint32_t get_bits_per_sample() const;                     ///< See FLAC__stream_decoder_get_bits_per_sample()
+                       virtual uint32_t get_sample_rate() const;                         ///< See FLAC__stream_decoder_get_sample_rate()
+                       virtual uint32_t get_blocksize() const;                           ///< See FLAC__stream_decoder_get_blocksize()
                        virtual bool get_decode_position(FLAC__uint64 *position) const;   ///< See FLAC__stream_decoder_get_decode_position()
 
                        virtual ::FLAC__StreamDecoderInitStatus init();      ///< Seek FLAC__stream_decoder_init_stream()
index b01a545..2706223 100644 (file)
@@ -128,46 +128,46 @@ namespace FLAC {
                        virtual bool set_ogg_serial_number(long value);                 ///< See FLAC__stream_encoder_set_ogg_serial_number()
                        virtual bool set_verify(bool value);                            ///< See FLAC__stream_encoder_set_verify()
                        virtual bool set_streamable_subset(bool value);                 ///< See FLAC__stream_encoder_set_streamable_subset()
-                       virtual bool set_channels(unsigned value);                      ///< See FLAC__stream_encoder_set_channels()
-                       virtual bool set_bits_per_sample(unsigned value);               ///< See FLAC__stream_encoder_set_bits_per_sample()
-                       virtual bool set_sample_rate(unsigned value);                   ///< See FLAC__stream_encoder_set_sample_rate()
-                       virtual bool set_compression_level(unsigned value);             ///< See FLAC__stream_encoder_set_compression_level()
-                       virtual bool set_blocksize(unsigned value);                     ///< See FLAC__stream_encoder_set_blocksize()
+                       virtual bool set_channels(uint32_t value);                      ///< See FLAC__stream_encoder_set_channels()
+                       virtual bool set_bits_per_sample(uint32_t value);               ///< See FLAC__stream_encoder_set_bits_per_sample()
+                       virtual bool set_sample_rate(uint32_t value);                   ///< See FLAC__stream_encoder_set_sample_rate()
+                       virtual bool set_compression_level(uint32_t value);             ///< See FLAC__stream_encoder_set_compression_level()
+                       virtual bool set_blocksize(uint32_t value);                     ///< See FLAC__stream_encoder_set_blocksize()
                        virtual bool set_do_mid_side_stereo(bool value);                ///< See FLAC__stream_encoder_set_do_mid_side_stereo()
                        virtual bool set_loose_mid_side_stereo(bool value);             ///< See FLAC__stream_encoder_set_loose_mid_side_stereo()
                        virtual bool set_apodization(const char *specification);        ///< See FLAC__stream_encoder_set_apodization()
-                       virtual bool set_max_lpc_order(unsigned value);                 ///< See FLAC__stream_encoder_set_max_lpc_order()
-                       virtual bool set_qlp_coeff_precision(unsigned value);           ///< See FLAC__stream_encoder_set_qlp_coeff_precision()
+                       virtual bool set_max_lpc_order(uint32_t value);                 ///< See FLAC__stream_encoder_set_max_lpc_order()
+                       virtual bool set_qlp_coeff_precision(uint32_t value);           ///< See FLAC__stream_encoder_set_qlp_coeff_precision()
                        virtual bool set_do_qlp_coeff_prec_search(bool value);          ///< See FLAC__stream_encoder_set_do_qlp_coeff_prec_search()
                        virtual bool set_do_escape_coding(bool value);                  ///< See FLAC__stream_encoder_set_do_escape_coding()
                        virtual bool set_do_exhaustive_model_search(bool value);        ///< See FLAC__stream_encoder_set_do_exhaustive_model_search()
-                       virtual bool set_min_residual_partition_order(unsigned value);  ///< See FLAC__stream_encoder_set_min_residual_partition_order()
-                       virtual bool set_max_residual_partition_order(unsigned value);  ///< See FLAC__stream_encoder_set_max_residual_partition_order()
-                       virtual bool set_rice_parameter_search_dist(unsigned value);    ///< See FLAC__stream_encoder_set_rice_parameter_search_dist()
+                       virtual bool set_min_residual_partition_order(uint32_t value);  ///< See FLAC__stream_encoder_set_min_residual_partition_order()
+                       virtual bool set_max_residual_partition_order(uint32_t value);  ///< See FLAC__stream_encoder_set_max_residual_partition_order()
+                       virtual bool set_rice_parameter_search_dist(uint32_t value);    ///< See FLAC__stream_encoder_set_rice_parameter_search_dist()
                        virtual bool set_total_samples_estimate(FLAC__uint64 value);    ///< See FLAC__stream_encoder_set_total_samples_estimate()
-                       virtual bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks);    ///< See FLAC__stream_encoder_set_metadata()
-                       virtual bool set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks); ///< See FLAC__stream_encoder_set_metadata()
+                       virtual bool set_metadata(::FLAC__StreamMetadata **metadata, uint32_t num_blocks);    ///< See FLAC__stream_encoder_set_metadata()
+                       virtual bool set_metadata(FLAC::Metadata::Prototype **metadata, uint32_t num_blocks); ///< See FLAC__stream_encoder_set_metadata()
 
                        /* get_state() is not virtual since we want subclasses to be able to return their own state */
                        State get_state() const;                                   ///< See FLAC__stream_encoder_get_state()
                        virtual Decoder::Stream::State get_verify_decoder_state() const; ///< See FLAC__stream_encoder_get_verify_decoder_state()
-                       virtual void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); ///< See FLAC__stream_encoder_get_verify_decoder_error_stats()
+                       virtual void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got); ///< See FLAC__stream_encoder_get_verify_decoder_error_stats()
                        virtual bool     get_verify() const;                       ///< See FLAC__stream_encoder_get_verify()
                        virtual bool     get_streamable_subset() const;            ///< See FLAC__stream_encoder_get_streamable_subset()
                        virtual bool     get_do_mid_side_stereo() const;           ///< See FLAC__stream_encoder_get_do_mid_side_stereo()
                        virtual bool     get_loose_mid_side_stereo() const;        ///< See FLAC__stream_encoder_get_loose_mid_side_stereo()
-                       virtual unsigned get_channels() const;                     ///< See FLAC__stream_encoder_get_channels()
-                       virtual unsigned get_bits_per_sample() const;              ///< See FLAC__stream_encoder_get_bits_per_sample()
-                       virtual unsigned get_sample_rate() const;                  ///< See FLAC__stream_encoder_get_sample_rate()
-                       virtual unsigned get_blocksize() const;                    ///< See FLAC__stream_encoder_get_blocksize()
-                       virtual unsigned get_max_lpc_order() const;                ///< See FLAC__stream_encoder_get_max_lpc_order()
-                       virtual unsigned get_qlp_coeff_precision() const;          ///< See FLAC__stream_encoder_get_qlp_coeff_precision()
+                       virtual uint32_t get_channels() const;                     ///< See FLAC__stream_encoder_get_channels()
+                       virtual uint32_t get_bits_per_sample() const;              ///< See FLAC__stream_encoder_get_bits_per_sample()
+                       virtual uint32_t get_sample_rate() const;                  ///< See FLAC__stream_encoder_get_sample_rate()
+                       virtual uint32_t get_blocksize() const;                    ///< See FLAC__stream_encoder_get_blocksize()
+                       virtual uint32_t get_max_lpc_order() const;                ///< See FLAC__stream_encoder_get_max_lpc_order()
+                       virtual uint32_t get_qlp_coeff_precision() const;          ///< See FLAC__stream_encoder_get_qlp_coeff_precision()
                        virtual bool     get_do_qlp_coeff_prec_search() const;     ///< See FLAC__stream_encoder_get_do_qlp_coeff_prec_search()
                        virtual bool     get_do_escape_coding() const;             ///< See FLAC__stream_encoder_get_do_escape_coding()
                        virtual bool     get_do_exhaustive_model_search() const;   ///< See FLAC__stream_encoder_get_do_exhaustive_model_search()
-                       virtual unsigned get_min_residual_partition_order() const; ///< See FLAC__stream_encoder_get_min_residual_partition_order()
-                       virtual unsigned get_max_residual_partition_order() const; ///< See FLAC__stream_encoder_get_max_residual_partition_order()
-                       virtual unsigned get_rice_parameter_search_dist() const;   ///< See FLAC__stream_encoder_get_rice_parameter_search_dist()
+                       virtual uint32_t get_min_residual_partition_order() const; ///< See FLAC__stream_encoder_get_min_residual_partition_order()
+                       virtual uint32_t get_max_residual_partition_order() const; ///< See FLAC__stream_encoder_get_max_residual_partition_order()
+                       virtual uint32_t get_rice_parameter_search_dist() const;   ///< See FLAC__stream_encoder_get_rice_parameter_search_dist()
                        virtual FLAC__uint64 get_total_samples_estimate() const;   ///< See FLAC__stream_encoder_get_total_samples_estimate()
 
                        virtual ::FLAC__StreamEncoderInitStatus init();            ///< See FLAC__stream_encoder_init_stream()
@@ -175,14 +175,14 @@ namespace FLAC {
 
                        virtual bool finish(); ///< See FLAC__stream_encoder_finish()
 
-                       virtual bool process(const FLAC__int32 * const buffer[], unsigned samples);     ///< See FLAC__stream_encoder_process()
-                       virtual bool process_interleaved(const FLAC__int32 buffer[], unsigned samples); ///< See FLAC__stream_encoder_process_interleaved()
+                       virtual bool process(const FLAC__int32 * const buffer[], uint32_t samples);     ///< See FLAC__stream_encoder_process()
+                       virtual bool process_interleaved(const FLAC__int32 buffer[], uint32_t samples); ///< See FLAC__stream_encoder_process_interleaved()
                protected:
                        /// See FLAC__StreamEncoderReadCallback
                        virtual ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes);
 
                        /// See FLAC__StreamEncoderWriteCallback
-                       virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame) = 0;
+                       virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame) = 0;
 
                        /// See FLAC__StreamEncoderSeekCallback
                        virtual ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
@@ -200,7 +200,7 @@ namespace FLAC {
                        ::FLAC__StreamEncoder *encoder_;
 
                        static ::FLAC__StreamEncoderReadStatus read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
-                       static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
+                       static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data);
                        static ::FLAC__StreamEncoderSeekStatus seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
                        static ::FLAC__StreamEncoderTellStatus tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
                        static void metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data);
@@ -245,12 +245,12 @@ namespace FLAC {
                        virtual ::FLAC__StreamEncoderInitStatus init_ogg(const std::string &filename); ///< See FLAC__stream_encoder_init_ogg_file()
                protected:
                        /// See FLAC__StreamEncoderProgressCallback
-                       virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate);
+                       virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate);
 
                        /// This is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
-                       virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame);
+                       virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame);
                private:
-                       static void progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
+                       static void progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data);
 
                        // Private and undefined so you can't use them:
                        File(const Stream &);
index 60051d6..9c959a0 100644 (file)
@@ -199,7 +199,7 @@ namespace FLAC {
                         * \assert
                         *   \code is_valid() \endcode
                         */
-                       unsigned get_length() const;
+                       uint32_t get_length() const;
 
                        /** Sets the "is_last" flag for the block.  When using the iterators
                         *  it is not necessary to set this flag; they will do it for you.
@@ -315,23 +315,23 @@ namespace FLAC {
 
                        //@{
                        /** See <A HREF="../format.html#metadata_block_streaminfo">format specification</A>. */
-                       unsigned get_min_blocksize() const;
-                       unsigned get_max_blocksize() const;
-                       unsigned get_min_framesize() const;
-                       unsigned get_max_framesize() const;
-                       unsigned get_sample_rate() const;
-                       unsigned get_channels() const;
-                       unsigned get_bits_per_sample() const;
+                       uint32_t get_min_blocksize() const;
+                       uint32_t get_max_blocksize() const;
+                       uint32_t get_min_framesize() const;
+                       uint32_t get_max_framesize() const;
+                       uint32_t get_sample_rate() const;
+                       uint32_t get_channels() const;
+                       uint32_t get_bits_per_sample() const;
                        FLAC__uint64 get_total_samples() const;
                        const FLAC__byte *get_md5sum() const;
 
-                       void set_min_blocksize(unsigned value);
-                       void set_max_blocksize(unsigned value);
-                       void set_min_framesize(unsigned value);
-                       void set_max_framesize(unsigned value);
-                       void set_sample_rate(unsigned value);
-                       void set_channels(unsigned value);
-                       void set_bits_per_sample(unsigned value);
+                       void set_min_blocksize(uint32_t value);
+                       void set_max_blocksize(uint32_t value);
+                       void set_min_framesize(uint32_t value);
+                       void set_max_framesize(uint32_t value);
+                       void set_sample_rate(uint32_t value);
+                       void set_channels(uint32_t value);
+                       void set_bits_per_sample(uint32_t value);
                        void set_total_samples(FLAC__uint64 value);
                        void set_md5sum(const FLAC__byte value[16]);
                        //@}
@@ -361,7 +361,7 @@ namespace FLAC {
 
                        /** Constructs an object with the given length.
                         */
-                       Padding(unsigned length);
+                       Padding(uint32_t length);
 
                        ~Padding();
 
@@ -393,7 +393,7 @@ namespace FLAC {
 
                        /** Sets the length in bytes of the padding block.
                         */
-                       void set_length(unsigned length);
+                       void set_length(uint32_t length);
                };
 
                /** APPLICATION metadata block.
@@ -451,8 +451,8 @@ namespace FLAC {
 
                        void set_id(const FLAC__byte value[4]);
                        //! This form always copies \a data
-                       bool set_data(const FLAC__byte *data, unsigned length);
-                       bool set_data(FLAC__byte *data, unsigned length, bool copy);
+                       bool set_data(const FLAC__byte *data, uint32_t length);
+                       bool set_data(FLAC__byte *data, uint32_t length, bool copy);
                };
 
                /** SEEKTABLE metadata block.
@@ -505,38 +505,38 @@ namespace FLAC {
                        inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
                        //@}
 
-                       unsigned get_num_points() const;
-                       ::FLAC__StreamMetadata_SeekPoint get_point(unsigned index) const;
+                       uint32_t get_num_points() const;
+                       ::FLAC__StreamMetadata_SeekPoint get_point(uint32_t index) const;
 
                        //! See FLAC__metadata_object_seektable_resize_points()
-                       bool resize_points(unsigned new_num_points);
+                       bool resize_points(uint32_t new_num_points);
 
                        //! See FLAC__metadata_object_seektable_set_point()
-                       void set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
+                       void set_point(uint32_t index, const ::FLAC__StreamMetadata_SeekPoint &point);
 
                        //! See FLAC__metadata_object_seektable_insert_point()
-                       bool insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point);
+                       bool insert_point(uint32_t index, const ::FLAC__StreamMetadata_SeekPoint &point);
 
                        //! See FLAC__metadata_object_seektable_delete_point()
-                       bool delete_point(unsigned index);
+                       bool delete_point(uint32_t index);
 
                        //! See FLAC__metadata_object_seektable_is_legal()
                        bool is_legal() const;
 
                        //! See FLAC__metadata_object_seektable_template_append_placeholders()
-                       bool template_append_placeholders(unsigned num);
+                       bool template_append_placeholders(uint32_t num);
 
                        //! See FLAC__metadata_object_seektable_template_append_point()
                        bool template_append_point(FLAC__uint64 sample_number);
 
                        //! See FLAC__metadata_object_seektable_template_append_points()
-                       bool template_append_points(FLAC__uint64 sample_numbers[], unsigned num);
+                       bool template_append_points(FLAC__uint64 sample_numbers[], uint32_t num);
 
                        //! See FLAC__metadata_object_seektable_template_append_spaced_points()
-                       bool template_append_spaced_points(unsigned num, FLAC__uint64 total_samples);
+                       bool template_append_spaced_points(uint32_t num, FLAC__uint64 total_samples);
 
                        //! See FLAC__metadata_object_seektable_template_append_spaced_points_by_samples()
-                       bool template_append_spaced_points_by_samples(unsigned samples, FLAC__uint64 total_samples);
+                       bool template_append_spaced_points_by_samples(uint32_t samples, FLAC__uint64 total_samples);
 
                        //! See FLAC__metadata_object_seektable_template_sort()
                        bool template_sort(bool compact);
@@ -581,10 +581,10 @@ namespace FLAC {
                        public:
                                Entry();
 
-                               Entry(const char *field, unsigned field_length);
+                               Entry(const char *field, uint32_t field_length);
                                Entry(const char *field); // assumes \a field is NUL-terminated
 
-                               Entry(const char *field_name, const char *field_value, unsigned field_value_length);
+                               Entry(const char *field_name, const char *field_value, uint32_t field_value_length);
                                Entry(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
 
                                Entry(const Entry &entry);
@@ -595,36 +595,36 @@ namespace FLAC {
 
                                virtual bool is_valid() const; ///< Returns \c true iff object was properly constructed.
 
-                               unsigned get_field_length() const;
-                               unsigned get_field_name_length() const;
-                               unsigned get_field_value_length() const;
+                               uint32_t get_field_length() const;
+                               uint32_t get_field_name_length() const;
+                               uint32_t get_field_value_length() const;
 
                                ::FLAC__StreamMetadata_VorbisComment_Entry get_entry() const;
                                const char *get_field() const;
                                const char *get_field_name() const;
                                const char *get_field_value() const;
 
-                               bool set_field(const char *field, unsigned field_length);
+                               bool set_field(const char *field, uint32_t field_length);
                                bool set_field(const char *field); // assumes \a field is NUL-terminated
                                bool set_field_name(const char *field_name);
-                               bool set_field_value(const char *field_value, unsigned field_value_length);
+                               bool set_field_value(const char *field_value, uint32_t field_value_length);
                                bool set_field_value(const char *field_value); // assumes \a field_value is NUL-terminated
                        protected:
                                bool is_valid_;
                                ::FLAC__StreamMetadata_VorbisComment_Entry entry_;
                                char *field_name_;
-                               unsigned field_name_length_;
+                               uint32_t field_name_length_;
                                char *field_value_;
-                               unsigned field_value_length_;
+                               uint32_t field_value_length_;
                        private:
                                void zero();
                                void clear();
                                void clear_entry();
                                void clear_field_name();
                                void clear_field_value();
-                               void construct(const char *field, unsigned field_length);
+                               void construct(const char *field, uint32_t field_length);
                                void construct(const char *field); // assumes \a field is NUL-terminated
-                               void construct(const char *field_name, const char *field_value, unsigned field_value_length);
+                               void construct(const char *field_name, const char *field_value, uint32_t field_value_length);
                                void construct(const char *field_name, const char *field_value); // assumes \a field_value is NUL-terminated
                                void compose_field();
                                void parse_field();
@@ -674,21 +674,21 @@ namespace FLAC {
                        inline bool operator!=(const ::FLAC__StreamMetadata *object) const { return Prototype::operator!=(object); }
                        //@}
 
-                       unsigned get_num_comments() const;
+                       uint32_t get_num_comments() const;
                        const FLAC__byte *get_vendor_string() const; // NUL-terminated UTF-8 string
-                       Entry get_comment(unsigned index) const;
+                       Entry get_comment(uint32_t index) const;
 
                        //! See FLAC__metadata_object_vorbiscomment_set_vendor_string()
                        bool set_vendor_string(const FLAC__byte *string); // NUL-terminated UTF-8 string
 
                        //! See FLAC__metadata_object_vorbiscomment_resize_comments()
-                       bool resize_comments(unsigned new_num_comments);
+                       bool resize_comments(uint32_t new_num_comments);
 
                        //! See FLAC__metadata_object_vorbiscomment_set_comment()
-                       bool set_comment(unsigned index, const Entry &entry);
+                       bool set_comment(uint32_t index, const Entry &entry);
 
                        //! See FLAC__metadata_object_vorbiscomment_insert_comment()
-                       bool insert_comment(unsigned index, const Entry &entry);
+                       bool insert_comment(uint32_t index, const Entry &entry);
 
                        //! See FLAC__metadata_object_vorbiscomment_append_comment()
                        bool append_comment(const Entry &entry);
@@ -697,10 +697,10 @@ namespace FLAC {
                        bool replace_comment(const Entry &entry, bool all);
 
                        //! See FLAC__metadata_object_vorbiscomment_delete_comment()
-                       bool delete_comment(unsigned index);
+                       bool delete_comment(uint32_t index);
 
                        //! See FLAC__metadata_object_vorbiscomment_find_entry_from()
-                       int find_entry_from(unsigned offset, const char *field_name);
+                       int find_entry_from(uint32_t offset, const char *field_name);
 
                        //! See FLAC__metadata_object_vorbiscomment_remove_entry_matching()
                        int remove_entry_matching(const char *field_name);
@@ -738,21 +738,21 @@ namespace FLAC {
                                inline FLAC__uint64 get_offset() const { return object_->offset; }
                                inline FLAC__byte get_number() const { return object_->number; }
                                inline const char *get_isrc() const { return object_->isrc; }
-                               inline unsigned get_type() const { return object_->type; }
+                               inline uint32_t get_type() const { return object_->type; }
                                inline bool get_pre_emphasis() const { return object_->pre_emphasis; }
 
                                inline FLAC__byte get_num_indices() const { return object_->num_indices; }
-                               ::FLAC__StreamMetadata_CueSheet_Index get_index(unsigned i) const;
+                               ::FLAC__StreamMetadata_CueSheet_Index get_index(uint32_t i) const;
 
                                inline const ::FLAC__StreamMetadata_CueSheet_Track *get_track() const { return object_; }
 
                                inline void set_offset(FLAC__uint64 value) { object_->offset = value; }
                                inline void set_number(FLAC__byte value) { object_->number = value; }
                                void set_isrc(const char value[12]);
-                               void set_type(unsigned value);
+                               void set_type(uint32_t value);
                                inline void set_pre_emphasis(bool value) { object_->pre_emphasis = value? 1 : 0; }
 
-                               void set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
+                               void set_index(uint32_t i, const ::FLAC__StreamMetadata_CueSheet_Index &index);
                                //@@@ It's awkward but to insert/delete index points
                                //@@@ you must use the routines in the CueSheet class.
                        };
@@ -805,41 +805,41 @@ namespace FLAC {
                        FLAC__uint64 get_lead_in() const;
                        bool get_is_cd() const;
 
-                       unsigned get_num_tracks() const;
-                       Track get_track(unsigned i) const;
+                       uint32_t get_num_tracks() const;
+                       Track get_track(uint32_t i) const;
 
                        void set_media_catalog_number(const char value[128]);
                        void set_lead_in(FLAC__uint64 value);
                        void set_is_cd(bool value);
 
-                       void set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
+                       void set_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
 
                        //! See FLAC__metadata_object_cuesheet_track_resize_indices()
-                       bool resize_indices(unsigned track_num, unsigned new_num_indices);
+                       bool resize_indices(uint32_t track_num, uint32_t new_num_indices);
 
                        //! See FLAC__metadata_object_cuesheet_track_insert_index()
-                       bool insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
+                       bool insert_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index);
 
                        //! See FLAC__metadata_object_cuesheet_track_insert_blank_index()
-                       bool insert_blank_index(unsigned track_num, unsigned index_num);
+                       bool insert_blank_index(uint32_t track_num, uint32_t index_num);
 
                        //! See FLAC__metadata_object_cuesheet_track_delete_index()
-                       bool delete_index(unsigned track_num, unsigned index_num);
+                       bool delete_index(uint32_t track_num, uint32_t index_num);
 
                        //! See FLAC__metadata_object_cuesheet_resize_tracks()
-                       bool resize_tracks(unsigned new_num_tracks);
+                       bool resize_tracks(uint32_t new_num_tracks);
 
                        //! See FLAC__metadata_object_cuesheet_set_track()
-                       bool set_track(unsigned i, const Track &track);
+                       bool set_track(uint32_t i, const Track &track);
 
                        //! See FLAC__metadata_object_cuesheet_insert_track()
-                       bool insert_track(unsigned i, const Track &track);
+                       bool insert_track(uint32_t i, const Track &track);
 
                        //! See FLAC__metadata_object_cuesheet_insert_blank_track()
-                       bool insert_blank_track(unsigned i);
+                       bool insert_blank_track(uint32_t i);
 
                        //! See FLAC__metadata_object_cuesheet_delete_track()
-                       bool delete_track(unsigned i);
+                       bool delete_track(uint32_t i);
 
                        //! See FLAC__metadata_object_cuesheet_is_legal()
                        bool is_legal(bool check_cd_da_subset = false, const char **violation = 0) const;
@@ -983,8 +983,8 @@ namespace FLAC {
                        const FLAC__byte *get_data() const;
 
                        //! This form always copies \a data
-                       bool set_data(const FLAC__byte *data, unsigned length);
-                       bool set_data(FLAC__byte *data, unsigned length, bool copy);
+                       bool set_data(const FLAC__byte *data, uint32_t length);
+                       bool set_data(FLAC__byte *data, uint32_t length, bool copy);
                };
 
                /* \} */
@@ -1010,8 +1010,8 @@ namespace FLAC {
                FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet); ///< See FLAC__metadata_get_cuesheet().
                FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet); ///< See FLAC__metadata_get_cuesheet().
 
-               FLACPP_API bool get_picture(const char *filename, Picture *&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); ///< See FLAC__metadata_get_picture().
-               FLACPP_API bool get_picture(const char *filename, Picture &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); ///< See FLAC__metadata_get_picture().
+               FLACPP_API bool get_picture(const char *filename, Picture *&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); ///< See FLAC__metadata_get_picture().
+               FLACPP_API bool get_picture(const char *filename, Picture &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); ///< See FLAC__metadata_get_picture().
 
                /* \} */
 
@@ -1079,7 +1079,7 @@ namespace FLAC {
 
                        off_t get_block_offset() const;                                     ///< See FLAC__metadata_simple_iterator_get_block_offset().
                        ::FLAC__MetadataType get_block_type() const;                        ///< See FLAC__metadata_simple_iterator_get_block_type().
-                       unsigned get_block_length() const;                                  ///< See FLAC__metadata_simple_iterator_get_block_length().
+                       uint32_t get_block_length() const;                                  ///< See FLAC__metadata_simple_iterator_get_block_length().
                        bool get_application_id(FLAC__byte *id);                            ///< See FLAC__metadata_simple_iterator_get_application_id().
                        Prototype *get_block();                                             ///< See FLAC__metadata_simple_iterator_get_block().
                        bool set_block(Prototype *block, bool use_padding = true);          ///< See FLAC__metadata_simple_iterator_set_block().
index e944493..683b644 100644 (file)
 
 typedef struct {
        FLAC__int32 residual;
-       unsigned count;
+       uint32_t count;
 } pair_t;
 
 typedef struct {
        pair_t buckets[FLAC__MAX_BLOCK_SIZE];
        int peak_index;
-       unsigned nbuckets;
-       unsigned nsamples;
+       uint32_t nbuckets;
+       uint32_t nsamples;
        double sum, sos;
        double variance;
        double mean;
@@ -51,7 +51,7 @@ typedef struct {
 static subframe_stats_t all_;
 
 static void init_stats(subframe_stats_t *stats);
-static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr);
+static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, uint32_t incr);
 static void compute_stats(subframe_stats_t *stats);
 static FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename);
 
@@ -62,19 +62,19 @@ void flac__analyze_init(analysis_options aopts)
        }
 }
 
-void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout)
+void flac__analyze_frame(const FLAC__Frame *frame, uint32_t frame_number, FLAC__uint64 frame_offset, uint32_t frame_bytes, analysis_options aopts, FILE *fout)
 {
-       const unsigned channels = frame->header.channels;
+       const uint32_t channels = frame->header.channels;
        char outfilename[1024];
        subframe_stats_t stats;
-       unsigned i, channel, partitions;
+       uint32_t i, channel, partitions;
 
        /* do the human-readable part first */
        fprintf(fout, "frame=%u\toffset=%" PRIu64 "\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]);
        for(channel = 0; channel < channels; channel++) {
                const FLAC__Subframe *subframe = frame->subframes+channel;
                const FLAC__bool is_rice2 = subframe->data.fixed.entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2;
-               const unsigned pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
+               const uint32_t pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER;
                fprintf(fout, "\tsubframe=%u\twasted_bits=%u\ttype=%s", channel, subframe->wasted_bits, FLAC__SubframeTypeString[subframe->type]);
                switch(subframe->type) {
                        case FLAC__SUBFRAME_TYPE_CONSTANT:
@@ -87,7 +87,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__
                                        fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.fixed.warmup[i]);
                                partitions = (1u << subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order);
                                for(i = 0; i < partitions; i++) {
-                                       unsigned parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
+                                       uint32_t parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
                                        if(parameter == pesc)
                                                fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]);
                                        else
@@ -107,7 +107,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__
                                        fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.lpc.warmup[i]);
                                partitions = (1u << subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order);
                                for(i = 0; i < partitions; i++) {
-                                       unsigned parameter = subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
+                                       uint32_t parameter = subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->parameters[i];
                                        if(parameter == pesc)
                                                fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]);
                                        else
@@ -128,7 +128,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__
        if(aopts.do_residual_gnuplot) {
                for(channel = 0; channel < channels; channel++) {
                        const FLAC__Subframe *subframe = frame->subframes+channel;
-                       unsigned residual_samples;
+                       uint32_t residual_samples;
 
                        init_stats(&stats);
 
@@ -178,9 +178,9 @@ void init_stats(subframe_stats_t *stats)
        stats->sos = 0.0;
 }
 
-void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr)
+void update_stats(subframe_stats_t *stats, FLAC__int32 residual, uint32_t incr)
 {
-       unsigned i;
+       uint32_t i;
        const double r = (double)residual, a = r*incr;
 
        stats->nsamples += incr;
@@ -213,7 +213,7 @@ void compute_stats(subframe_stats_t *stats)
 FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename)
 {
        FILE *outfile;
-       unsigned i;
+       uint32_t i;
        const double m = stats->mean;
        const double s1 = stats->stddev, s2 = s1*2, s3 = s1*3, s4 = s1*4, s5 = s1*5, s6 = s1*6;
        const double p = stats->buckets[stats->peak_index].count;
index 30fdbbb..88bc279 100644 (file)
@@ -62,7 +62,7 @@ typedef struct {
        const char *outfilename;
 
        FLAC__uint64 samples_processed;
-       unsigned frame_counter;
+       uint32_t frame_counter;
        FLAC__bool abort_flag;
        FLAC__bool aborting_due_to_until; /* true if we intentionally abort decoding prematurely because we hit the --until point */
        FLAC__bool aborting_due_to_unparseable; /* true if we abort decoding because we hit an unparseable frame */
@@ -75,9 +75,9 @@ typedef struct {
        FLAC__bool got_stream_info;
        FLAC__bool has_md5sum;
        FLAC__uint64 total_samples;
-       unsigned bps;
-       unsigned channels;
-       unsigned sample_rate;
+       uint32_t bps;
+       uint32_t channels;
+       uint32_t sample_rate;
        FLAC__uint32 channel_mask;
 
        /* these are used only in analyze mode */
@@ -104,16 +104,16 @@ static FLAC__bool DecoderSession_init_decoder(DecoderSession *d, const char *inf
 static FLAC__bool DecoderSession_process(DecoderSession *d);
 static int DecoderSession_finish_ok(DecoderSession *d);
 static int DecoderSession_finish_error(DecoderSession *d);
-static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input);
+static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input);
 static FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uint64 samples);
-static FLAC__bool write_riff_wave_fmt_chunk_body(FILE *f, FLAC__bool is_waveformatextensible, unsigned bps, unsigned channels, unsigned sample_rate, FLAC__uint32 channel_mask);
-static FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, unsigned bps, unsigned channels, unsigned sample_rate);
+static FLAC__bool write_riff_wave_fmt_chunk_body(FILE *f, FLAC__bool is_waveformatextensible, uint32_t bps, uint32_t channels, uint32_t sample_rate, FLAC__uint32 channel_mask);
+static FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, uint32_t bps, uint32_t channels, uint32_t sample_rate);
 static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 val);
 static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 val);
 static FLAC__bool write_little_endian_uint64(FILE *f, FLAC__uint64 val);
 static FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 val);
 static FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 val);
-static FLAC__bool write_sane_extended(FILE *f, unsigned val);
+static FLAC__bool write_sane_extended(FILE *f, uint32_t val);
 static FLAC__bool fixup_iff_headers(DecoderSession *d);
 static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
 static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
@@ -441,13 +441,13 @@ FLAC__bool DecoderSession_process(DecoderSession *d)
        /* write padding bytes for alignment if necessary */
        if(!d->analysis_mode && !d->test_only && d->format != FORMAT_RAW) {
                const FLAC__uint64 data_size = d->total_samples * d->channels * ((d->bps+7)/8);
-               unsigned padding;
+               uint32_t padding;
                if(d->format != FORMAT_WAVE64) {
-                       padding = (unsigned)(data_size & 1);
+                       padding = (uint32_t)(data_size & 1);
                }
                else {
                        /* 8-byte alignment for Wave64 */
-                       padding = (8 - (unsigned)(data_size & 7)) & 7;
+                       padding = (8 - (uint32_t)(data_size & 7)) & 7;
                }
                for( ; padding > 0; --padding) {
                        if(flac__utils_fwrite("\000", 1, 1, d->fout) != 1) {
@@ -525,7 +525,7 @@ int DecoderSession_finish_error(DecoderSession *d)
        return 1;
 }
 
-FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input)
+FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input)
 {
        /* convert from mm:ss.sss to sample number if necessary */
        flac__utils_canonicalize_skip_until_specification(spec, sample_rate);
@@ -592,7 +592,7 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin
                        (data_size+1) & (~(FLAC__uint64)1);
 
        FLAC__uint64 iff_size;
-       unsigned foreign_metadata_size = 0; /* size of all non-audio non-fmt/COMM foreign metadata chunks */
+       uint32_t foreign_metadata_size = 0; /* size of all non-audio non-fmt/COMM foreign metadata chunks */
        foreign_metadata_t *fm = decoder_session->foreign_metadata;
        size_t i;
 
@@ -818,7 +818,7 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin
        return true;
 }
 
-FLAC__bool write_riff_wave_fmt_chunk_body(FILE *f, FLAC__bool is_waveformatextensible, unsigned bps, unsigned channels, unsigned sample_rate, FLAC__uint32 channel_mask)
+FLAC__bool write_riff_wave_fmt_chunk_body(FILE *f, FLAC__bool is_waveformatextensible, uint32_t bps, uint32_t channels, uint32_t sample_rate, FLAC__uint32 channel_mask)
 {
        if(!write_little_endian_uint16(f, (FLAC__uint16)(is_waveformatextensible? 65534 : 1))) /* compression code */
                return false;
@@ -856,7 +856,7 @@ FLAC__bool write_riff_wave_fmt_chunk_body(FILE *f, FLAC__bool is_waveformatexten
        return true;
 }
 
-FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, unsigned bps, unsigned channels, unsigned sample_rate)
+FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, uint32_t bps, uint32_t channels, uint32_t sample_rate)
 {
        FLAC__ASSERT(samples <= 0xffffffff);
 
@@ -936,7 +936,7 @@ FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 val)
        return flac__utils_fwrite(b, 1, 4, f) == 4;
 }
 
-FLAC__bool write_sane_extended(FILE *f, unsigned val)
+FLAC__bool write_sane_extended(FILE *f, uint32_t val)
        /* Write to 'f' a SANE extended representation of 'val'.  Return false if
        * the write succeeds; return true otherwise.
        *
@@ -948,7 +948,7 @@ FLAC__bool write_sane_extended(FILE *f, unsigned val)
        *  val!=0U
        */
 {
-       unsigned int shift, exponent;
+       uint32_t shift, exponent;
 
        FLAC__ASSERT(val!=0U); /* handling 0 would require a special case */
 
@@ -994,8 +994,8 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
 {
        DecoderSession *decoder_session = (DecoderSession*)client_data;
        FILE *fout = decoder_session->fout;
-       const unsigned bps = frame->header.bits_per_sample, channels = frame->header.channels;
-       const unsigned shift = (decoder_session->format != FORMAT_RAW && (bps%8))? 8-(bps%8): 0;
+       const uint32_t bps = frame->header.bits_per_sample, channels = frame->header.channels;
+       const uint32_t shift = (decoder_session->format != FORMAT_RAW && (bps%8))? 8-(bps%8): 0;
        FLAC__bool is_big_endian = (
                decoder_session->format == FORMAT_AIFF || decoder_session->format == FORMAT_AIFF_C ? true : (
                decoder_session->format == FORMAT_WAVE || decoder_session->format == FORMAT_WAVE64 || decoder_session->format == FORMAT_RF64 ? false :
@@ -1006,8 +1006,8 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
                decoder_session->format == FORMAT_WAVE || decoder_session->format == FORMAT_WAVE64 || decoder_session->format == FORMAT_RF64 ? bps<=8 :
                decoder_session->is_unsigned_samples
        ));
-       unsigned wide_samples = frame->header.blocksize, wide_sample, sample, channel;
-       unsigned frame_bytes = 0;
+       uint32_t wide_samples = frame->header.blocksize, wide_sample, sample, channel;
+       uint32_t frame_bytes = 0;
 
        static union
        {       /* The arrays defined within this union are all the same size. */
@@ -1106,7 +1106,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
                const FLAC__uint64 input_samples_passed = skip + decoder_session->samples_processed;
                FLAC__ASSERT(until >= input_samples_passed);
                if(input_samples_passed + wide_samples > until)
-                       wide_samples = (unsigned)(until - input_samples_passed);
+                       wide_samples = (uint32_t)(until - input_samples_passed);
                if (wide_samples == 0) {
                        decoder_session->abort_flag = true;
                        decoder_session->aborting_due_to_until = true;
@@ -1117,7 +1117,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
        if(decoder_session->analysis_mode) {
                FLAC__uint64 dpos;
                FLAC__stream_decoder_get_decode_position(decoder_session->decoder, &dpos);
-               frame_bytes = (unsigned)(dpos-decoder_session->decode_position);
+               frame_bytes = (uint32_t)(dpos-decoder_session->decode_position);
                decoder_session->decode_position = dpos;
        }
 
@@ -1207,9 +1207,9 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
                                        }
                                }
                                if(is_big_endian != is_big_endian_host_) {
-                                       unsigned char tmp;
-                                       const unsigned bytes = sample * 2;
-                                       unsigned b;
+                                       uint8_t tmp;
+                                       const uint32_t bytes = sample * 2;
+                                       uint32_t b;
                                        for(b = 0; b < bytes; b += 2) {
                                                tmp = ubuf.u8buffer[b];
                                                ubuf.u8buffer[b] = ubuf.u8buffer[b+1];
@@ -1230,9 +1230,9 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
                                                        ubuf.s32buffer[sample] = buffer[channel][wide_sample];
                                }
                                if(is_big_endian != is_big_endian_host_) {
-                                       unsigned char tmp;
-                                       const unsigned bytes = sample * 4;
-                                       unsigned b;
+                                       uint8_t tmp;
+                                       const uint32_t bytes = sample * 4;
+                                       uint32_t b;
                                        for(b = 0; b < bytes; b += 4) {
                                                tmp = ubuf.u8buffer[b];
                                                ubuf.u8buffer[b] = ubuf.u8buffer[b+3];
@@ -1243,8 +1243,8 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
                                        }
                                }
                                if(is_big_endian) {
-                                       unsigned b, lbyte;
-                                       const unsigned bytes = sample * 4;
+                                       uint32_t b, lbyte;
+                                       const uint32_t bytes = sample * 4;
                                        for(lbyte = b = 0; b < bytes; ) {
                                                b++;
                                                ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++];
@@ -1253,8 +1253,8 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder
                                        }
                                }
                                else {
-                                       unsigned b, lbyte;
-                                       const unsigned bytes = sample * 4;
+                                       uint32_t b, lbyte;
+                                       const uint32_t bytes = sample * 4;
                                        for(lbyte = b = 0; b < bytes; ) {
                                                ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++];
                                                ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++];
@@ -1481,13 +1481,13 @@ void print_stats(const DecoderSession *decoder_session)
                const double progress = (double)decoder_session->samples_processed / (double)decoder_session->total_samples * 100.0;
 
                if(decoder_session->total_samples > 0) {
-                       if ((unsigned)floor(progress + 0.5) == 100)
+                       if ((uint32_t)floor(progress + 0.5) == 100)
                                return;
 
                        stats_print_name(2, decoder_session->inbasefilename);
                        stats_print_info(2, "%s%u%% complete",
                                decoder_session->test_only? "testing, " : decoder_session->analysis_mode? "analyzing, " : "",
-                               (unsigned)floor(progress + 0.5)
+                               (uint32_t)floor(progress + 0.5)
                        );
                }
                else {
index 8b08bea..73c1576 100644 (file)
 #define CHUNK_OF_SAMPLES 2048
 
 typedef struct {
-       unsigned sample_rate;
-       unsigned channels;
-       unsigned bits_per_sample; /* width of sample point, including 'shift' bits, valid bps is bits_per_sample-shift */
-       unsigned shift; /* # of LSBs samples have been shifted left by */
-       unsigned bytes_per_wide_sample; /* for convenience, always == channels*((bps+7)/8), or 0 if N/A to input format (like FLAC) */
+       uint32_t sample_rate;
+       uint32_t channels;
+       uint32_t bits_per_sample; /* width of sample point, including 'shift' bits, valid bps is bits_per_sample-shift */
+       uint32_t shift; /* # of LSBs samples have been shifted left by */
+       uint32_t bytes_per_wide_sample; /* for convenience, always == channels*((bps+7)/8), or 0 if N/A to input format (like FLAC) */
        FLAC__bool is_unsigned_samples;
        FLAC__bool is_big_endian;
        FLAC__uint32 channel_mask;
@@ -64,7 +64,7 @@ typedef struct {
 typedef struct {
        FLAC__off_t filesize;
        const FLAC__byte *lookahead;
-       unsigned lookahead_length;
+       uint32_t lookahead_length;
        size_t num_metadata_blocks;
        FLAC__StreamMetadata *metadata_blocks[1024]; /*@@@ BAD MAGIC number */
        FLAC__uint64 samples_left_to_process;
@@ -89,8 +89,8 @@ typedef struct {
        FLAC__uint64 unencoded_size; /* an estimate of the input size, only used in the progress indicator */
        FLAC__uint64 bytes_written;
        FLAC__uint64 samples_written;
-       unsigned stats_frames_interval;
-       unsigned old_frames_written;
+       uint32_t stats_frames_interval;
+       uint32_t old_frames_written;
 
        SampleInfo info;
 
@@ -133,18 +133,18 @@ static FLAC__int32 *input_[FLAC__MAX_CHANNELS];
 /*
  * local routines
  */
-static FLAC__bool EncoderSession_construct(EncoderSession *e, encode_options_t options, FLAC__off_t infilesize, FILE *infile, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length);
+static FLAC__bool EncoderSession_construct(EncoderSession *e, encode_options_t options, FLAC__off_t infilesize, FILE *infile, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, uint32_t lookahead_length);
 static void EncoderSession_destroy(EncoderSession *e);
 static int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_align_zero, foreign_metadata_t *foreign_metadata, FLAC__bool error_on_compression_fail);
 static int EncoderSession_finish_error(EncoderSession *e);
 static FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options);
-static FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], unsigned samples);
+static FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], uint32_t samples);
 static FLAC__bool EncoderSession_format_is_iff(const EncoderSession *e);
 static FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int num_requested_seek_points, FLAC__StreamMetadata *cuesheet, EncoderSession *e);
-static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input);
-static FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, unsigned num_metadata);
-static FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map);
-static void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
+static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input);
+static FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, uint32_t num_metadata);
+static FLAC__bool format_input(FLAC__int32 *dest[], uint32_t wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, uint32_t channels, uint32_t bps, uint32_t shift, size_t *channel_map);
+static void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data);
 static FLAC__StreamDecoderReadStatus flac_decoder_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
 static FLAC__StreamDecoderSeekStatus flac_decoder_seek_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
 static FLAC__StreamDecoderTellStatus flac_decoder_tell_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
@@ -153,7 +153,7 @@ static FLAC__bool flac_decoder_eof_callback(const FLAC__StreamDecoder *decoder,
 static FLAC__StreamDecoderWriteStatus flac_decoder_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
 static void flac_decoder_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
 static void flac_decoder_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
-static FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, unsigned sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors);
+static FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors);
 static void print_stats(const EncoderSession *encoder_session);
 static void print_error_with_init_status(const EncoderSession *e, const char *message, FLAC__StreamEncoderInitStatus init_status);
 static void print_error_with_state(const EncoderSession *e, const char *message);
@@ -164,9 +164,9 @@ static FLAC__bool read_uint32(FILE *f, FLAC__bool big_endian, FLAC__uint32 *val,
 static FLAC__bool read_uint64(FILE *f, FLAC__bool big_endian, FLAC__uint64 *val, const char *fn);
 static FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, const char *fn);
 static FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset);
-static unsigned count_channel_mask_bits(FLAC__uint32 mask);
+static uint32_t count_channel_mask_bits(FLAC__uint32 mask);
 #if 0
-static FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, unsigned channels);
+static FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, uint32_t channels);
 #endif
 
 static FLAC__bool get_sample_info_raw(EncoderSession *e, encode_options_t options)
@@ -186,7 +186,7 @@ static FLAC__bool get_sample_info_raw(EncoderSession *e, encode_options_t option
 static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t options)
 {
        FLAC__bool got_fmt_chunk = false, got_data_chunk = false, got_ds64_chunk = false;
-       unsigned sample_rate = 0, channels = 0, bps = 0, shift = 0;
+       uint32_t sample_rate = 0, channels = 0, bps = 0, shift = 0;
        FLAC__uint32 channel_mask = 0;
        FLAC__uint64 ds64_data_size = 0;
 
@@ -233,7 +233,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                return false;
                        data_bytes = xx;
                        if(data_bytes < 28) {
-                               flac__utils_printf(stderr, 1, "%s: ERROR: non-standard 'ds64' chunk has length = %u\n", e->inbasefilename, (unsigned)data_bytes);
+                               flac__utils_printf(stderr, 1, "%s: ERROR: non-standard 'ds64' chunk has length = %u\n", e->inbasefilename, (uint32_t)data_bytes);
                                return false;
                        }
                        if(data_bytes & 1) /* should never happen, but enforce WAVE alignment rules */
@@ -300,7 +300,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                         * If the channel mask has more set bits than # of channels, the extra MSBs are ignored.
                         * If the channel mask has less set bits than # of channels, the extra channels are unassigned to any speaker.
                         *
-                        * Data is supposed to be unsigned for bps <= 8 else signed.
+                        * Data is supposed to be uint32_t for bps <= 8 else signed.
                         */
 
                        /* fmt chunk size */
@@ -312,18 +312,18 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename))
                                        return false;
                                if(xx) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly large Wave64 'fmt ' chunk has length = 0x%08X%08X\n", e->inbasefilename, (unsigned)xx, (unsigned)data_bytes);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly large Wave64 'fmt ' chunk has length = 0x%08X%08X\n", e->inbasefilename, (uint32_t)xx, (uint32_t)data_bytes);
                                        return false;
                                }
                                /* subtract size of header */
                                if (data_bytes < 16+8) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 'fmt ' chunk has length = 0x%08X%08X\n", e->inbasefilename, (unsigned)xx, (unsigned)data_bytes);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 'fmt ' chunk has length = 0x%08X%08X\n", e->inbasefilename, (uint32_t)xx, (uint32_t)data_bytes);
                                        return false;
                                }
                                data_bytes -= (16+8);
                        }
                        if(data_bytes < 16) {
-                               flac__utils_printf(stderr, 1, "%s: ERROR: non-standard 'fmt ' chunk has length = %u\n", e->inbasefilename, (unsigned)data_bytes);
+                               flac__utils_printf(stderr, 1, "%s: ERROR: non-standard 'fmt ' chunk has length = %u\n", e->inbasefilename, (uint32_t)data_bytes);
                                return false;
                        }
                        if(e->format != FORMAT_WAVE64) {
@@ -338,14 +338,14 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                        if(!read_uint16(e->fin, /*big_endian=*/false, &wFormatTag, e->inbasefilename))
                                return false;
                        if(wFormatTag != 1 /*WAVE_FORMAT_PCM*/ && wFormatTag != 65534 /*WAVE_FORMAT_EXTENSIBLE*/) {
-                               flac__utils_printf(stderr, 1, "%s: ERROR: unsupported format type %u\n", e->inbasefilename, (unsigned)wFormatTag);
+                               flac__utils_printf(stderr, 1, "%s: ERROR: unsupported format type %u\n", e->inbasefilename, (uint32_t)wFormatTag);
                                return false;
                        }
 
                        /* number of channels */
                        if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename))
                                return false;
-                       channels = (unsigned)x;
+                       channels = (uint32_t)x;
 
                        /* sample rate */
                        if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename))
@@ -362,7 +362,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                        /* bits per sample */
                        if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename))
                                return false;
-                       bps = (unsigned)x;
+                       bps = (uint32_t)x;
 
                        e->info.is_unsigned_samples = (bps <= 8);
 
@@ -370,13 +370,13 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                if(bps != 8 && bps != 16) {
                                        if(bps == 24 || bps == 32) {
                                                /* let these slide with a warning since they're unambiguous */
-                                               flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file has format type %u but bits-per-sample=%u\n", e->inbasefilename, (unsigned)wFormatTag, bps);
+                                               flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file has format type %u but bits-per-sample=%u\n", e->inbasefilename, (uint32_t)wFormatTag, bps);
                                                if(e->treat_warnings_as_errors)
                                                        return false;
                                        }
                                        else {
                                                /* @@@ we could add an option to specify left- or right-justified blocks so we knew how to set 'shift' */
-                                               flac__utils_printf(stderr, 1, "%s: ERROR: legacy WAVE file has format type %u but bits-per-sample=%u\n", e->inbasefilename, (unsigned)wFormatTag, bps);
+                                               flac__utils_printf(stderr, 1, "%s: ERROR: legacy WAVE file has format type %u but bits-per-sample=%u\n", e->inbasefilename, (uint32_t)wFormatTag, bps);
                                                return false;
                                        }
                                }
@@ -384,7 +384,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                if((bps+7)/8 * channels == block_align) {
                                        if(bps % 8) {
                                                /* assume legacy file is byte aligned with some LSBs zero; this is double-checked in format_input() */
-                                               flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", e->inbasefilename, (unsigned)wFormatTag, block_align, bps, channels);
+                                               flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", e->inbasefilename, (uint32_t)wFormatTag, block_align, bps, channels);
                                                if(e->treat_warnings_as_errors)
                                                        return false;
                                                shift = 8 - (bps % 8);
@@ -394,7 +394,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                                shift = 0;
                                }
                                else {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: illegal WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", e->inbasefilename, (unsigned)wFormatTag, block_align, bps, channels);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: illegal WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", e->inbasefilename, (uint32_t)wFormatTag, block_align, bps, channels);
                                        return false;
                                }
 #else
@@ -409,24 +409,24 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                        }
                        else {
                                if(data_bytes < 40) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with size %u\n", e->inbasefilename, (unsigned)data_bytes);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with size %u\n", e->inbasefilename, (uint32_t)data_bytes);
                                        return false;
                                }
                                /* cbSize */
                                if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename))
                                        return false;
                                if(x < 22) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with cbSize %u\n", e->inbasefilename, (unsigned)x);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with cbSize %u\n", e->inbasefilename, (uint32_t)x);
                                        return false;
                                }
                                /* valid bps */
                                if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename))
                                        return false;
-                               if((unsigned)x > bps) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with wValidBitsPerSample (%u) > wBitsPerSample (%u)\n", e->inbasefilename, (unsigned)x, bps);
+                               if((uint32_t)x > bps) {
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with wValidBitsPerSample (%u) > wBitsPerSample (%u)\n", e->inbasefilename, (uint32_t)x, bps);
                                        return false;
                                }
-                               shift = bps - (unsigned)x;
+                               shift = bps - (uint32_t)x;
                                /* channel mask */
                                if(!read_uint32(e->fin, /*big_endian=*/false, &channel_mask, e->inbasefilename))
                                        return false;
@@ -495,12 +495,12 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                }
 #endif
                                else {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk with unsupported channel mask=0x%04X\n\nUse --channel-map=none option to encode the input\n", e->inbasefilename, (unsigned)channel_mask);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk with unsupported channel mask=0x%04X\n\nUse --channel-map=none option to encode the input\n", e->inbasefilename, (uint32_t)channel_mask);
                                        return false;
                                }
                                if(!options.channel_map_none) {
                                        if(count_channel_mask_bits(channel_mask) < channels) {
-                                               flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has unassigned channels (#channels=%u)\n", e->inbasefilename, (unsigned)channel_mask, channels);
+                                               flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has unassigned channels (#channels=%u)\n", e->inbasefilename, (uint32_t)channel_mask, channels);
                                                return false;
                                        }
 #if 0
@@ -512,7 +512,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                                channel_mask = limit_channel_mask(channel_mask, channels);
 #else
                                        else if(count_channel_mask_bits(channel_mask) > channels) {
-                                               flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has extra bits for non-existant channels (#channels=%u)\n", e->inbasefilename, (unsigned)channel_mask, channels);
+                                               flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has extra bits for non-existant channels (#channels=%u)\n", e->inbasefilename, (uint32_t)channel_mask, channels);
                                                return false;
                                        }
 #endif
@@ -521,7 +521,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename))
                                        return false;
                                if(x != 1) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: unsupported WAVEFORMATEXTENSIBLE chunk with non-PCM format %u\n", e->inbasefilename, (unsigned)x);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: unsupported WAVEFORMATEXTENSIBLE chunk with non-PCM format %u\n", e->inbasefilename, (uint32_t)x);
                                        return false;
                                }
                                data_bytes -= 26;
@@ -560,7 +560,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                        return false;
                                /* subtract size of header */
                                if (data_bytes < 16+8) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 'data' chunk has length = 0x00000000%08X\n", e->inbasefilename, (unsigned)data_bytes);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 'data' chunk has length = 0x00000000%08X\n", e->inbasefilename, (uint32_t)data_bytes);
                                        return false;
                                }
                                data_bytes -= (16+8);
@@ -601,22 +601,22 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                else
                                        flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown chunk %02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X (use --keep-foreign-metadata to keep)\n",
                                                e->inbasefilename,
-                                               (unsigned)((const unsigned char *)chunk_id)[3],
-                                               (unsigned)((const unsigned char *)chunk_id)[2],
-                                               (unsigned)((const unsigned char *)chunk_id)[1],
-                                               (unsigned)((const unsigned char *)chunk_id)[0],
-                                               (unsigned)((const unsigned char *)chunk_id)[5],
-                                               (unsigned)((const unsigned char *)chunk_id)[4],
-                                               (unsigned)((const unsigned char *)chunk_id)[7],
-                                               (unsigned)((const unsigned char *)chunk_id)[6],
-                                               (unsigned)((const unsigned char *)chunk_id)[9],
-                                               (unsigned)((const unsigned char *)chunk_id)[8],
-                                               (unsigned)((const unsigned char *)chunk_id)[10],
-                                               (unsigned)((const unsigned char *)chunk_id)[11],
-                                               (unsigned)((const unsigned char *)chunk_id)[12],
-                                               (unsigned)((const unsigned char *)chunk_id)[13],
-                                               (unsigned)((const unsigned char *)chunk_id)[14],
-                                               (unsigned)((const unsigned char *)chunk_id)[15]
+                                               (uint32_t)((const uint8_t *)chunk_id)[3],
+                                               (uint32_t)((const uint8_t *)chunk_id)[2],
+                                               (uint32_t)((const uint8_t *)chunk_id)[1],
+                                               (uint32_t)((const uint8_t *)chunk_id)[0],
+                                               (uint32_t)((const uint8_t *)chunk_id)[5],
+                                               (uint32_t)((const uint8_t *)chunk_id)[4],
+                                               (uint32_t)((const uint8_t *)chunk_id)[7],
+                                               (uint32_t)((const uint8_t *)chunk_id)[6],
+                                               (uint32_t)((const uint8_t *)chunk_id)[9],
+                                               (uint32_t)((const uint8_t *)chunk_id)[8],
+                                               (uint32_t)((const uint8_t *)chunk_id)[10],
+                                               (uint32_t)((const uint8_t *)chunk_id)[11],
+                                               (uint32_t)((const uint8_t *)chunk_id)[12],
+                                               (uint32_t)((const uint8_t *)chunk_id)[13],
+                                               (uint32_t)((const uint8_t *)chunk_id)[14],
+                                               (uint32_t)((const uint8_t *)chunk_id)[15]
                                        );
                                if(e->treat_warnings_as_errors)
                                        return false;
@@ -635,7 +635,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
                                skip = (skip+7) & (~(FLAC__uint64)7);
                                /* subtract size of header */
                                if (skip < 16+8) {
-                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 chunk has length = 0x00000000%08X\n", e->inbasefilename, (unsigned)skip);
+                                       flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 chunk has length = 0x00000000%08X\n", e->inbasefilename, (uint32_t)skip);
                                        return false;
                                }
                                skip -= (16+8);
@@ -670,7 +670,7 @@ static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t optio
 static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t options)
 {
        FLAC__bool got_comm_chunk = false, got_ssnd_chunk = false;
-       unsigned sample_rate = 0, channels = 0, bps = 0, shift = 0;
+       uint32_t sample_rate = 0, channels = 0, bps = 0, shift = 0;
        FLAC__uint64 sample_frames = 0;
        FLAC__uint32 channel_mask = 0;
 
@@ -692,7 +692,7 @@ static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t optio
                if(!memcmp(chunk_id, "COMM", 4)) { /* common chunk */
                        FLAC__uint16 x;
                        FLAC__uint32 xx;
-                       unsigned long skip;
+                       uint64_t skip;
                        const FLAC__bool is_aifc = e->format == FORMAT_AIFF_C;
                        const FLAC__uint32 minimum_comm_size = (is_aifc? 22 : 18);
 
@@ -705,11 +705,11 @@ static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t optio
                        if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename))
                                return false;
                        else if(xx < minimum_comm_size) {
-                               flac__utils_printf(stderr, 1, "%s: ERROR: non-standard %s 'COMM' chunk has length = %u\n", e->inbasefilename, is_aifc? "AIFF-C" : "AIFF", (unsigned int)xx);
+                               flac__utils_printf(stderr, 1, "%s: ERROR: non-standard %s 'COMM' chunk has length = %u\n", e->inbasefilename, is_aifc? "AIFF-C" : "AIFF", (uint32_t)xx);
                                return false;
                        }
                        else if(!is_aifc && xx != minimum_comm_size) {
-                               flac__utils_printf(stderr, 1, "%s: WARNING: non-standard %s 'COMM' chunk has length = %u, expected %u\n", e->inbasefilename, is_aifc? "AIFF-C" : "AIFF", (unsigned int)xx, minimum_comm_size);
+                               flac__utils_printf(stderr, 1, "%s: WARNING: non-standard %s 'COMM' chunk has length = %u, expected %u\n", e->inbasefilename, is_aifc? "AIFF-C" : "AIFF", (uint32_t)xx, minimum_comm_size);
                                if(e->treat_warnings_as_errors)
                                        return false;
                        }
@@ -718,7 +718,7 @@ static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t optio
                        /* number of channels */
                        if(!read_uint16(e->fin, /*big_endian=*/true, &x, e->inbasefilename))
                                return false;
-                       channels = (unsigned)x;
+                       channels = (uint32_t)x;
                        if(channels > 2 && !options.channel_map_none) {
                                flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number of channels %u for AIFF\n", e->inbasefilename, channels);
                                return false;
@@ -732,7 +732,7 @@ static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t optio
                        /* bits per sample */
                        if(!read_uint16(e->fin, /*big_endian=*/true, &x, e->inbasefilename))
                                return false;
-                       bps = (unsigned)x;
+                       bps = (uint32_t)x;
                        shift = (bps%8)? 8-(bps%8) : 0; /* SSND data is always byte-aligned, left-justified but format_input() will double-check */
                        bps += shift;
 
@@ -797,7 +797,7 @@ static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t optio
                else if(!memcmp(chunk_id, "SSND", 4) && !got_ssnd_chunk) { /* sound data chunk */
                        FLAC__uint32 xx;
                        FLAC__uint64 data_bytes;
-                       unsigned offset = 0;
+                       uint32_t offset = 0;
 
                        if(!got_comm_chunk) {
                                flac__utils_printf(stderr, 1, "%s: ERROR: got 'SSND' chunk before 'COMM' chunk\n", e->inbasefilename);
@@ -866,7 +866,7 @@ static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t optio
                        if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename))
                                return false;
                        else {
-                               unsigned long skip = xx + (xx & 1);
+                               uint64_t skip = xx + (xx & 1);
 
                                FLAC__ASSERT(skip <= LONG_MAX);
                                if(!fskip_ahead(e->fin, skip)) {
@@ -952,7 +952,7 @@ static FLAC__bool get_sample_info_flac(EncoderSession *e)
 /*
  * public routines
  */
-int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, encode_options_t options)
+int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, uint32_t lookahead_length, encode_options_t options)
 {
        EncoderSession encoder_session;
        size_t channel_map[FLAC__MAX_CHANNELS];
@@ -1050,8 +1050,8 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                FLAC__uint64 total_samples_in_input; /* WATCHOUT: may be 0 to mean "unknown" */
                FLAC__uint64 skip;
                FLAC__uint64 until; /* a value of 0 mean end-of-stream (i.e. --until=-0) */
-               unsigned consecutive_eos_count = 0;
-               unsigned align_remainder = 0;
+               uint32_t consecutive_eos_count = 0;
+               uint32_t align_remainder = 0;
 
                switch(options.format) {
                        case FORMAT_RAW:
@@ -1139,7 +1139,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                }
                if(options.sector_align && (options.format != FORMAT_RAW || infilesize >=0)) { /* for RAW, need to know the filesize */
                        FLAC__ASSERT(skip == 0); /* asserted above too, but lest we forget */
-                       align_remainder = (unsigned)(encoder_session.total_samples_to_encode % 588);
+                       align_remainder = (uint32_t)(encoder_session.total_samples_to_encode % 588);
                        if(options.is_last_file)
                                encoder_session.total_samples_to_encode += (588-align_remainder); /* will pad with zeroes */
                        else
@@ -1202,7 +1202,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                        switch(options.format) {
                                case FORMAT_RAW:
                                        {
-                                               unsigned skip_bytes = encoder_session.info.bytes_per_wide_sample * (unsigned)skip;
+                                               uint32_t skip_bytes = encoder_session.info.bytes_per_wide_sample * (uint32_t)skip;
                                                if(skip_bytes > lookahead_length) {
                                                        skip_bytes -= lookahead_length;
                                                        lookahead_length = 0;
@@ -1289,7 +1289,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                if(lookahead_length > 0) {
                                                        FLAC__ASSERT(lookahead_length < CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample);
                                                        memcpy(ubuffer.u8, lookahead, lookahead_length);
-                                                       bytes_read = fread(ubuffer.u8+lookahead_length, sizeof(unsigned char), CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample - lookahead_length, infile) + lookahead_length;
+                                                       bytes_read = fread(ubuffer.u8+lookahead_length, sizeof(uint8_t), CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample - lookahead_length, infile) + lookahead_length;
                                                        if(ferror(infile)) {
                                                                flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename);
                                                                return EncoderSession_finish_error(&encoder_session);
@@ -1297,7 +1297,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                        lookahead_length = 0;
                                                }
                                                else
-                                                       bytes_read = fread(ubuffer.u8, sizeof(unsigned char), CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample, infile);
+                                                       bytes_read = fread(ubuffer.u8, sizeof(uint8_t), CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample, infile);
 
                                                if(bytes_read == 0) {
                                                        if(ferror(infile)) {
@@ -1310,7 +1310,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                        return EncoderSession_finish_error(&encoder_session);
                                                }
                                                else {
-                                                       unsigned wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample;
+                                                       uint32_t wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample;
                                                        if(!format_input(input_, wide_samples, encoder_session.info.is_big_endian, encoder_session.info.is_unsigned_samples, encoder_session.info.channels, encoder_session.info.bits_per_sample, encoder_session.info.shift, channel_map))
                                                                return EncoderSession_finish_error(&encoder_session);
 
@@ -1336,7 +1336,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                                wanted -= lookahead_length;
                                                                bytes_read = lookahead_length;
                                                                if(wanted > 0) {
-                                                                       bytes_read += fread(ubuffer.u8+lookahead_length, sizeof(unsigned char), wanted, infile);
+                                                                       bytes_read += fread(ubuffer.u8+lookahead_length, sizeof(uint8_t), wanted, infile);
                                                                        if(ferror(infile)) {
                                                                                flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename);
                                                                                return EncoderSession_finish_error(&encoder_session);
@@ -1345,7 +1345,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                                lookahead_length = 0;
                                                        }
                                                        else
-                                                               bytes_read = fread(ubuffer.u8, sizeof(unsigned char), wanted, infile);
+                                                               bytes_read = fread(ubuffer.u8, sizeof(uint8_t), wanted, infile);
                                                }
 
                                                if(bytes_read == 0) {
@@ -1366,7 +1366,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                                return EncoderSession_finish_error(&encoder_session);
                                                        }
                                                        else {
-                                                               unsigned wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample;
+                                                               uint32_t wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample;
                                                                if(!format_input(input_, wide_samples, encoder_session.info.is_big_endian, encoder_session.info.is_unsigned_samples, encoder_session.info.channels, encoder_session.info.bits_per_sample, encoder_session.info.shift, channel_map))
                                                                        return EncoderSession_finish_error(&encoder_session);
 
@@ -1390,7 +1390,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                min (sizeof (ubuffer.u8),
                                                        min ((size_t)encoder_session.fmt.iff.data_bytes,
                                                                CHUNK_OF_SAMPLES * (size_t)encoder_session.info.bytes_per_wide_sample));
-                                       size_t bytes_read = fread(ubuffer.u8, sizeof(unsigned char), bytes_to_read, infile);
+                                       size_t bytes_read = fread(ubuffer.u8, sizeof(uint8_t), bytes_to_read, infile);
                                        if(bytes_read == 0) {
                                                if(ferror(infile)) {
                                                        flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename);
@@ -1414,7 +1414,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                                        return EncoderSession_finish_error(&encoder_session);
                                                }
                                                else {
-                                                       unsigned wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample;
+                                                       uint32_t wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample;
                                                        if(!format_input(input_, wide_samples, encoder_session.info.is_big_endian, encoder_session.info.is_unsigned_samples, encoder_session.info.channels, encoder_session.info.bits_per_sample, encoder_session.info.shift, channel_map))
                                                                return EncoderSession_finish_error(&encoder_session);
 
@@ -1469,9 +1469,9 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                 */
                if(options.sector_align) {
                        if(options.is_last_file) {
-                               unsigned wide_samples = 588 - align_remainder;
+                               uint32_t wide_samples = 588 - align_remainder;
                                if(wide_samples < 588) {
-                                       unsigned channel;
+                                       uint32_t channel;
 
                                        info_align_zero = wide_samples;
                                        for(channel = 0; channel < encoder_session.info.channels; channel++)
@@ -1487,7 +1487,7 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
                                if(*options.align_reservoir_samples > 0) {
                                        size_t bytes_read;
                                        FLAC__ASSERT(CHUNK_OF_SAMPLES >= 588);
-                                       bytes_read = fread(ubuffer.u8, sizeof(unsigned char), (*options.align_reservoir_samples) * encoder_session.info.bytes_per_wide_sample, infile);
+                                       bytes_read = fread(ubuffer.u8, sizeof(uint8_t), (*options.align_reservoir_samples) * encoder_session.info.bytes_per_wide_sample, infile);
                                        if(bytes_read == 0 && ferror(infile)) {
                                                flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename);
                                                return EncoderSession_finish_error(&encoder_session);
@@ -1516,9 +1516,9 @@ int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilena
        );
 }
 
-FLAC__bool EncoderSession_construct(EncoderSession *e, encode_options_t options, FLAC__off_t infilesize, FILE *infile, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length)
+FLAC__bool EncoderSession_construct(EncoderSession *e, encode_options_t options, FLAC__off_t infilesize, FILE *infile, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, uint32_t lookahead_length)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__uint32 test = 1;
 
        /*
@@ -1712,7 +1712,7 @@ int EncoderSession_finish_error(EncoderSession *e)
 }
 
 typedef struct {
-       unsigned num_metadata;
+       uint32_t num_metadata;
        FLAC__bool *needs_delete;
        FLAC__StreamMetadata **metadata;
        FLAC__StreamMetadata *cuesheet; /* always needs to be deleted */
@@ -1728,7 +1728,7 @@ static void static_metadata_init(static_metadata_t *m)
 
 static void static_metadata_clear(static_metadata_t *m)
 {
-       unsigned i;
+       uint32_t i;
        for(i = 0; i < m->num_metadata; i++)
                if(m->needs_delete[i])
                        FLAC__metadata_object_delete(m->metadata[i]);
@@ -1758,14 +1758,14 @@ static FLAC__bool static_metadata_append(static_metadata_t *m, FLAC__StreamMetad
 
 FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options)
 {
-       const unsigned channels = e->info.channels;
-       const unsigned bps = e->info.bits_per_sample - e->info.shift;
-       const unsigned sample_rate = e->info.sample_rate;
+       const uint32_t channels = e->info.channels;
+       const uint32_t bps = e->info.bits_per_sample - e->info.shift;
+       const uint32_t sample_rate = e->info.sample_rate;
        FLACDecoderData *flac_decoder_data = (e->format == FORMAT_FLAC || e->format == FORMAT_OGGFLAC)? &e->fmt.flac.client_data : 0;
        FLAC__StreamMetadata padding;
        FLAC__StreamMetadata **metadata = 0;
        static_metadata_t static_metadata;
-       unsigned num_metadata = 0, ic;
+       uint32_t num_metadata = 0, ic;
        FLAC__StreamEncoderInitStatus init_status;
        const FLAC__bool is_cdda = (channels == 1 || channels == 2) && (bps == 16) && (sample_rate == 44100);
        char apodizations[2000];
@@ -1811,7 +1811,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
                 * metadata as the basis for the encoded file
                 */
                {
-                       unsigned i;
+                       uint32_t i;
                        /*
                         * first handle pictures: simple append any --pictures
                         * specified.
@@ -2036,7 +2036,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
                 * from scratch
                 */
                const foreign_metadata_t *foreign_metadata = EncoderSession_format_is_iff(e)? options.format_options.iff.foreign_metadata : 0;
-               unsigned i;
+               uint32_t i;
 
                if(e->seek_table_template->data.seek_table.num_points > 0) {
                        e->seek_table_template->is_last = false; /* the encoder will set this for us */
@@ -2069,7 +2069,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
                if(options.padding != 0) {
                        padding.is_last = false; /* the encoder will set this for us */
                        padding.type = FLAC__METADATA_TYPE_PADDING;
-                       padding.length = (unsigned)(options.padding>0? options.padding : (e->total_samples_to_encode / sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8)) + (e->replay_gain ? GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED : 0);
+                       padding.length = (uint32_t)(options.padding>0? options.padding : (e->total_samples_to_encode / sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8)) + (e->replay_gain ? GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED : 0);
                        padding.length = min(padding.length, (1u << FLAC__STREAM_METADATA_LENGTH_LEN) - 1);
                        static_metadata_append(&static_metadata, &padding, /*needs_delete=*/false);
                }
@@ -2193,7 +2193,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
        return true;
 }
 
-FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], unsigned samples)
+FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], uint32_t samples)
 {
        if(e->replay_gain) {
                if(!grabbag__replaygain_analyze(buffer, e->info.channels==2, e->info.bits_per_sample, samples)) {
@@ -2241,7 +2241,7 @@ FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int
        }
 
        if(0 != cuesheet) {
-               unsigned i, j;
+               uint32_t i, j;
                const FLAC__StreamMetadata_CueSheet *cs = &cuesheet->data.cue_sheet;
                for(i = 0; i < cs->num_tracks; i++) {
                        const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+i;
@@ -2267,7 +2267,7 @@ FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int
        return true;
 }
 
-FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input)
+FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input)
 {
        /* convert from mm:ss.sss to sample number if necessary */
        flac__utils_canonicalize_skip_until_specification(spec, sample_rate);
@@ -2312,11 +2312,11 @@ FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec,
        return true;
 }
 
-FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, unsigned num_metadata)
+FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, uint32_t num_metadata)
 {
        FLAC__bool metadata_picture_has_type1 = false;
        FLAC__bool metadata_picture_has_type2 = false;
-       unsigned i;
+       uint32_t i;
 
        FLAC__ASSERT(0 != metadata);
        for(i = 0; i < num_metadata; i++) {
@@ -2359,9 +2359,9 @@ FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metad
        return true;
 }
 
-FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map)
+FLAC__bool format_input(FLAC__int32 *dest[], uint32_t wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, uint32_t channels, uint32_t bps, uint32_t shift, size_t *channel_map)
 {
-       unsigned wide_sample, sample, channel;
+       uint32_t wide_sample, sample, channel;
        FLAC__int32 *out[FLAC__MAX_CHANNELS];
 
        if(0 == channel_map) {
@@ -2387,9 +2387,9 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i
        }
        else if(bps == 16) {
                if(is_big_endian != is_big_endian_host_) {
-                       unsigned char tmp;
-                       const unsigned bytes = wide_samples * channels * (bps >> 3);
-                       unsigned b;
+                       uint8_t tmp;
+                       const uint32_t bytes = wide_samples * channels * (bps >> 3);
+                       uint32_t b;
                        for(b = 0; b < bytes; b += 2) {
                                tmp = ubuffer.u8[b];
                                ubuffer.u8[b] = ubuffer.u8[b+1];
@@ -2409,9 +2409,9 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i
        }
        else if(bps == 24) {
                if(!is_big_endian) {
-                       unsigned char tmp;
-                       const unsigned bytes = wide_samples * channels * (bps >> 3);
-                       unsigned b;
+                       uint8_t tmp;
+                       const uint32_t bytes = wide_samples * channels * (bps >> 3);
+                       uint32_t b;
                        for(b = 0; b < bytes; b += 3) {
                                tmp = ubuffer.u8[b];
                                ubuffer.u8[b] = ubuffer.u8[b+2];
@@ -2419,7 +2419,7 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i
                        }
                }
                if(is_unsigned_samples) {
-                       unsigned b;
+                       uint32_t b;
                        for(b = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
                                for(channel = 0; channel < channels; channel++, sample++) {
                                        uint32_t t;
@@ -2430,7 +2430,7 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i
                                }
                }
                else {
-                       unsigned b;
+                       uint32_t b;
                        for(b = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++)
                                for(channel = 0; channel < channels; channel++, sample++) {
                                        uint32_t t;
@@ -2458,7 +2458,7 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i
        return true;
 }
 
-void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data)
+void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data)
 {
        EncoderSession *e = (EncoderSession*)client_data;
 
@@ -2566,7 +2566,7 @@ FLAC__StreamDecoderWriteStatus flac_decoder_write_callback(const FLAC__StreamDec
        FLAC__uint64 n = min(data->samples_left_to_process, frame->header.blocksize);
        (void)decoder;
 
-       if(!EncoderSession_process(e, buffer, (unsigned)n)) {
+       if(!EncoderSession_process(e, buffer, (uint32_t)n)) {
                print_error_with_state(e, "ERROR during encoding");
                data->fatal_error = true;
                return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
@@ -2606,10 +2606,10 @@ void flac_decoder_error_callback(const FLAC__StreamDecoder *decoder, FLAC__Strea
                data->fatal_error = true;
 }
 
-FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, unsigned sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors)
+FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors)
 {
        FILE *f;
-       unsigned last_line_read;
+       uint32_t last_line_read;
        const char *error_message;
 
        if(0 == cuesheet_filename)
@@ -2672,7 +2672,7 @@ static void print_stats(const EncoderSession *encoder_session)
                }
                else {
                        stats_print_name(2, encoder_session->inbasefilename);
-                       stats_print_info(2, "%u%% complete, ratio=%s", (unsigned)floor(encoder_session->progress * 100.0 + 0.5), ratiostr);
+                       stats_print_info(2, "%u%% complete, ratio=%s", (uint32_t)floor(encoder_session->progress * 100.0 + 0.5), ratiostr);
                }
        }
 }
@@ -2741,9 +2741,9 @@ void print_error_with_state(const EncoderSession *e, const char *message)
 void print_verify_error(EncoderSession *e)
 {
        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;
 
@@ -2829,7 +2829,7 @@ FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, const char *fn)
         * 'val'; return true otherwise.
         */
 {
-       unsigned int i;
+       uint32_t i;
        FLAC__byte buf[10];
        FLAC__uint64 p = 0;
        FLAC__int16 e;
@@ -2853,7 +2853,7 @@ FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, const char *fn)
 
 FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset)
 {
-       static unsigned char dump[8192];
+       static uint8_t dump[8192];
        struct flac_stat_s stb;
 
        if(flac_fstat(fileno(f), &stb) == 0 && (stb.st_mode & S_IFMT) == S_IFREG)
@@ -2870,9 +2870,9 @@ FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset)
        return true;
 }
 
-unsigned count_channel_mask_bits(FLAC__uint32 mask)
+uint32_t count_channel_mask_bits(FLAC__uint32 mask)
 {
-       unsigned count = 0;
+       uint32_t count = 0;
        while(mask) {
                if(mask & 1)
                        count++;
@@ -2882,10 +2882,10 @@ unsigned count_channel_mask_bits(FLAC__uint32 mask)
 }
 
 #if 0
-FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, unsigned channels)
+FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, uint32_t channels)
 {
        FLAC__uint32 x = 0x80000000;
-       unsigned count = count_channel_mask_bits(mask);
+       uint32_t count = count_channel_mask_bits(mask);
        while(x && count > channels) {
                if(mask & x) {
                        mask &= ~x;
index 64a34cf..9ad9c18 100644 (file)
@@ -417,7 +417,7 @@ static FLAC__bool read_from_wave64_(foreign_metadata_t *fm, FILE *f, const char
 static FLAC__bool write_to_flac_(foreign_metadata_t *fm, FILE *fin, FILE *fout, FLAC__Metadata_SimpleIterator *it, const char **error)
 {
        FLAC__byte buffer[4];
-       const unsigned ID_LEN = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8;
+       const uint32_t ID_LEN = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8;
        size_t block_num = 0;
        FLAC__ASSERT(sizeof(buffer) >= ID_LEN);
        while(block_num < fm->num_blocks) {
index 55b0821..4e7361b 100644 (file)
@@ -62,7 +62,7 @@ static int parse_option(int short_option, const char *long_option, const char *o
 static void free_options(void);
 static void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool value);
 static void add_compression_setting_string(compression_setting_type_t type, const char *value);
-static void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value);
+static void add_compression_setting_uint32_t(compression_setting_type_t type, uint32_t value);
 
 static int usage_error(const char *message, ...);
 static void short_usage(void);
@@ -269,12 +269,12 @@ static struct {
        FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */
        FLAC__bool error_on_compression_fail;
 
-       unsigned num_files;
+       uint32_t num_files;
        char **filenames;
 
        FLAC__StreamMetadata *vorbis_comment;
        FLAC__StreamMetadata *pictures[64];
-       unsigned num_pictures;
+       uint32_t num_pictures;
 
        struct {
                FLAC__bool disable_constant_subframes;
@@ -291,7 +291,7 @@ static struct {
 
 static FLAC__int32 align_reservoir_0[588], align_reservoir_1[588]; /* for carrying over samples from --sector-align */ /* DEPRECATED */
 static FLAC__int32 *align_reservoir[2] = { align_reservoir_0, align_reservoir_1 };
-static unsigned align_reservoir_samples = 0; /* 0 .. 587 */
+static uint32_t align_reservoir_samples = 0; /* 0 .. 587 */
 
 
 int main(int argc, char *argv[])
@@ -309,7 +309,7 @@ int main(int argc, char *argv[])
        }
 #endif
 
-       srand((unsigned)time(0));
+       srand((uint32_t)time(0));
 #ifdef _WIN32
        {
                const char *var;
@@ -385,7 +385,7 @@ int do_it(void)
                        return usage_error("ERROR: --cue may not be combined with --skip or --until\n");
 
                if(option_values.format_channels >= 0) {
-                       if(option_values.format_channels == 0 || (unsigned)option_values.format_channels > FLAC__MAX_CHANNELS)
+                       if(option_values.format_channels == 0 || (uint32_t)option_values.format_channels > FLAC__MAX_CHANNELS)
                                return usage_error("ERROR: invalid number of channels '%u', must be > 0 and <= %u\n", option_values.format_channels, FLAC__MAX_CHANNELS);
                }
                if(option_values.format_bps >= 0) {
@@ -491,7 +491,7 @@ int do_it(void)
                        retval = decode_file("-");
                }
                else {
-                       unsigned i;
+                       uint32_t i;
                        if(option_values.num_files > 1)
                                option_values.cmdline_forced_outfilename = 0;
                        for(i = 0, retval = 0; i < option_values.num_files; i++) {
@@ -512,7 +512,7 @@ int do_it(void)
                        retval = encode_file("-", first, true);
                }
                else {
-                       unsigned i;
+                       uint32_t i;
                        if(option_values.num_files > 1)
                                option_values.cmdline_forced_outfilename = 0;
                        for(i = 0, retval = 0; i < option_values.num_files; i++) {
@@ -644,7 +644,7 @@ int parse_options(int argc, char *argv[])
        option_values.num_files = argc - share__optind;
 
        if(option_values.num_files > 0) {
-               unsigned i = 0;
+               uint32_t i = 0;
                if(0 == (option_values.filenames = malloc(sizeof(char*) * option_values.num_files)))
                        die("out of memory allocating space for file names list");
                while(share__optind < argc)
@@ -738,7 +738,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                        option_values.cuesheet_filename = option_argument;
                }
                else if(0 == strcmp(long_option, "picture")) {
-                       const unsigned max_pictures = sizeof(option_values.pictures)/sizeof(option_values.pictures[0]);
+                       const uint32_t max_pictures = sizeof(option_values.pictures)/sizeof(option_values.pictures[0]);
                        FLAC__ASSERT(0 != option_argument);
                        if(option_values.num_pictures >= max_pictures)
                                return usage_error("ERROR: too many --picture arguments, only %u allowed\n", max_pictures);
@@ -817,7 +817,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                        else if(0 == strncmp(option_argument, "unsigned", strlen(option_argument)))
                                option_values.format_is_unsigned_samples = true;
                        else
-                               return usage_error("ERROR: argument to --sign must be \"signed\" or \"unsigned\"\n");
+                               return usage_error("ERROR: argument to --sign must be \"signed\" or \"uint32_t\"\n");
                }
                else if(0 == strcmp(long_option, "residual-gnuplot")) {
                        option_values.aopts.do_residual_gnuplot = true;
@@ -970,7 +970,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                        case '6':
                        case '7':
                        case '8':
-                               add_compression_setting_unsigned(CST_COMPRESSION_LEVEL, short_option-'0');
+                               add_compression_setting_uint32_t(CST_COMPRESSION_LEVEL, short_option-'0');
                                break;
                        case '9':
                                return usage_error("ERROR: compression level '9' is reserved\n");
@@ -1007,12 +1007,12 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                                break;
                        case 'b':
                                {
-                                       unsigned i ;
+                                       uint32_t i ;
                                        FLAC__ASSERT(0 != option_argument);
                                        i = atoi(option_argument);
                                        if((i < (int)FLAC__MIN_BLOCK_SIZE || i > (int)FLAC__MAX_BLOCK_SIZE))
                                                return usage_error("ERROR: invalid blocksize (-%c) '%d', must be >= %u and <= %u\n", short_option, i, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);
-                                       add_compression_setting_unsigned(CST_BLOCKSIZE, (unsigned)i);
+                                       add_compression_setting_uint32_t(CST_BLOCKSIZE, (uint32_t)i);
                                }
                                break;
                        case 'e':
@@ -1023,12 +1023,12 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                                break;
                        case 'l':
                                {
-                                       unsigned i ;
+                                       uint32_t i ;
                                        FLAC__ASSERT(0 != option_argument);
                                        i = atoi(option_argument);
                                        if(i > FLAC__MAX_LPC_ORDER)
                                                return usage_error("ERROR: invalid LPC order (-%c) '%d', must be >= %u and <= %u\n", short_option, i, 0, FLAC__MAX_LPC_ORDER);
-                                       add_compression_setting_unsigned(CST_MAX_LPC_ORDER, i);
+                                       add_compression_setting_uint32_t(CST_MAX_LPC_ORDER, i);
                                }
                                break;
                        case 'A':
@@ -1048,44 +1048,44 @@ int parse_option(int short_option, const char *long_option, const char *option_a
                                break;
                        case 'q':
                                {
-                                       unsigned i ;
+                                       uint32_t i ;
                                        FLAC__ASSERT(0 != option_argument);
                                        i = atoi(option_argument);
                                        if((i > 0 && (i < FLAC__MIN_QLP_COEFF_PRECISION || i > FLAC__MAX_QLP_COEFF_PRECISION)))
                                                return usage_error("ERROR: invalid value '%d' for qlp coeff precision (-%c), must be 0 or between %u and %u, inclusive\n", i, short_option, FLAC__MIN_QLP_COEFF_PRECISION, FLAC__MAX_QLP_COEFF_PRECISION);
-                                       add_compression_setting_unsigned(CST_QLP_COEFF_PRECISION, i);
+                                       add_compression_setting_uint32_t(CST_QLP_COEFF_PRECISION, i);
                                }
                                break;
                        case 'r':
                                {
-                                       unsigned i;
+                                       uint32_t i;
                                        char * p;
                                        FLAC__ASSERT(0 != option_argument);
                                        p = strchr(option_argument, ',');
                                        if(0 == p) {
-                                               add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, 0);
+                                               add_compression_setting_uint32_t(CST_MIN_RESIDUAL_PARTITION_ORDER, 0);
                                                i = atoi(option_argument);
                                                if(i > FLAC__MAX_RICE_PARTITION_ORDER)
                                                        return usage_error("ERROR: invalid value '%d' for residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER);
-                                               add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, i);
+                                               add_compression_setting_uint32_t(CST_MAX_RESIDUAL_PARTITION_ORDER, i);
                                        }
                                        else {
                                                i = atoi(option_argument);
                                                if(i > FLAC__MAX_RICE_PARTITION_ORDER)
                                                        return usage_error("ERROR: invalid value '%d' for min residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER);
-                                               add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, i);
+                                               add_compression_setting_uint32_t(CST_MIN_RESIDUAL_PARTITION_ORDER, i);
                                                i = atoi(++p);
                                                if(i > FLAC__MAX_RICE_PARTITION_ORDER)
                                                        return usage_error("ERROR: invalid value '%d' for max residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER);
-                                               add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, i);
+                                               add_compression_setting_uint32_t(CST_MAX_RESIDUAL_PARTITION_ORDER, i);
                                        }
                                }
                                break;
                        case 'R':
                                {
-                                       unsigned i;
+                                       uint32_t i;
                                        i = atoi(option_argument);
-                                       add_compression_setting_unsigned(CST_RICE_PARAMETER_SEARCH_DIST, i);
+                                       add_compression_setting_uint32_t(CST_RICE_PARAMETER_SEARCH_DIST, i);
                                }
                                break;
                        default:
@@ -1098,7 +1098,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a
 
 void free_options(void)
 {
-       unsigned i;
+       uint32_t i;
        if(0 != option_values.filenames) {
                for(i = 0; i < option_values.num_files; i++) {
                        if(0 != option_values.filenames[i])
@@ -1130,7 +1130,7 @@ void add_compression_setting_string(compression_setting_type_t type, const char
        option_values.num_compression_settings++;
 }
 
-void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value)
+void add_compression_setting_uint32_t(compression_setting_type_t type, uint32_t value)
 {
        if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0]))
                die("too many compression settings");
@@ -1299,7 +1299,7 @@ void show_help(void)
        printf("      --channels=#             Number of channels\n");
        printf("      --bps=#                  Number of bits per sample\n");
        printf("      --sample-rate=#          Sample rate in Hz\n");
-       printf("      --sign={signed|unsigned} Sign of samples\n");
+       printf("      --sign={signed|uint32_t} Sign of samples\n");
        printf("      --input-size=#           Size of the raw input in bytes\n");
        printf("negative options:\n");
        printf("      --no-adaptive-mid-side\n");
@@ -1639,7 +1639,7 @@ void show_explain(void)
        printf("      --channels=#             Number of channels\n");
        printf("      --bps=#                  Number of bits per sample\n");
        printf("      --sample-rate=#          Sample rate in Hz\n");
-       printf("      --sign={signed|unsigned} Sign of samples (the default is signed)\n");
+       printf("      --sign={signed|uint32_t} Sign of samples (the default is signed)\n");
        printf("      --input-size=#           Size of the raw input in bytes.  If you are\n");
        printf("                               encoding raw samples from stdin, you must set\n");
        printf("                               this option in order to be able to use --skip,\n");
@@ -1686,7 +1686,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
 {
        FILE *encode_infile;
        FLAC__byte lookahead[12];
-       unsigned lookahead_length = 0;
+       uint32_t lookahead_length = 0;
        FileFormat input_format = FORMAT_RAW;
        int retval;
        FLAC__off_t infilesize;
index c2f5520..b727feb 100644 (file)
@@ -65,7 +65,7 @@ static FLAC__bool local__parse_uint64_(const char *s, FLAC__uint64 *value)
 static FLAC__bool local__parse_timecode_(const char *s, double *value)
 {
        double ret;
-       unsigned i;
+       uint32_t i;
        char c, *endptr;
 
        /* parse [0-9][0-9]*: */
@@ -93,10 +93,10 @@ static FLAC__bool local__parse_timecode_(const char *s, double *value)
        return true;
 }
 
-static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *track, unsigned *indx)
+static FLAC__bool local__parse_cue_(const char *s, const char *end, uint32_t *track, uint32_t *indx)
 {
        FLAC__bool got_track = false, got_index = false;
-       unsigned t = 0, i = 0;
+       uint32_t t = 0, i = 0;
        char c;
 
        while(end? s < end : *s != '\0') {
@@ -129,7 +129,7 @@ static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *tr
  * does not require sorted cuesheets).  but if it's not sorted, picking a
  * nearest cue point has no significance.
  */
-static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, unsigned track, unsigned indx, FLAC__uint64 total_samples, FLAC__bool look_forward)
+static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, uint32_t track, uint32_t indx, FLAC__uint64 total_samples, FLAC__bool look_forward)
 {
        int t, i;
        if(look_forward) {
@@ -315,7 +315,7 @@ FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__Skip
        return true;
 }
 
-void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, unsigned sample_rate)
+void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, uint32_t sample_rate)
 {
        FLAC__ASSERT(0 != spec);
        if(!spec->value_is_samples) {
@@ -391,7 +391,7 @@ FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
        FLAC__ASSERT(strlen(CHANNEL_MASK_TAG)+1+2+16+1 <= sizeof(tag)); /* +1 for =, +2 for 0x, +16 for digits, +1 for NUL */
        entry.entry = (FLAC__byte*)tag;
-       if((entry.length = flac_snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag))
+       if((entry.length = flac_snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (uint32_t)channel_mask)) >= sizeof(tag))
                return false;
        if(!FLAC__metadata_object_vorbiscomment_replace_comment(object, entry, /*all=*/true, /*copy=*/true))
                return false;
@@ -401,7 +401,7 @@ FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__
 FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object, FLAC__uint32 *channel_mask)
 {
        int offset;
-       unsigned val;
+       uint32_t val;
        char *p;
        FLAC__ASSERT(object);
        FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT);
index 3feffea..43de4cf 100644 (file)
@@ -42,7 +42,7 @@ typedef struct {
        char *field; /* the whole field as passed on the command line, i.e. "NAME=VALUE" */
        char *field_name;
        /* according to the vorbis spec, field values can contain \0 so simple C strings are not enough here */
-       unsigned field_value_length;
+       uint32_t field_value_length;
        char *field_value;
        FLAC__bool field_value_from_file; /* true if field_value holds a filename for the value, false for plain value */
 } Argument_VcField;
@@ -63,7 +63,7 @@ static char *local_strdup(const char *source)
        return ret;
 }
 
-static FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, unsigned *length, const char **violation)
+static FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, uint32_t *length, const char **violation)
 {
        static const char * const violations[] = {
                "field name contains invalid character",
index b3d04d7..ddedeed 100644 (file)
@@ -212,7 +212,7 @@ namespace FLAC {
                        return object_->type;
                }
 
-               unsigned Prototype::get_length() const
+               uint32_t Prototype::get_length() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->length;
@@ -236,43 +236,43 @@ namespace FLAC {
                StreamInfo::~StreamInfo()
                { }
 
-               unsigned StreamInfo::get_min_blocksize() const
+               uint32_t StreamInfo::get_min_blocksize() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.stream_info.min_blocksize;
                }
 
-               unsigned StreamInfo::get_max_blocksize() const
+               uint32_t StreamInfo::get_max_blocksize() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.stream_info.max_blocksize;
                }
 
-               unsigned StreamInfo::get_min_framesize() const
+               uint32_t StreamInfo::get_min_framesize() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.stream_info.min_framesize;
                }
 
-               unsigned StreamInfo::get_max_framesize() const
+               uint32_t StreamInfo::get_max_framesize() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.stream_info.max_framesize;
                }
 
-               unsigned StreamInfo::get_sample_rate() const
+               uint32_t StreamInfo::get_sample_rate() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.stream_info.sample_rate;
                }
 
-               unsigned StreamInfo::get_channels() const
+               uint32_t StreamInfo::get_channels() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.stream_info.channels;
                }
 
-               unsigned StreamInfo::get_bits_per_sample() const
+               uint32_t StreamInfo::get_bits_per_sample() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.stream_info.bits_per_sample;
@@ -290,7 +290,7 @@ namespace FLAC {
                        return object_->data.stream_info.md5sum;
                }
 
-               void StreamInfo::set_min_blocksize(unsigned value)
+               void StreamInfo::set_min_blocksize(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(value >= FLAC__MIN_BLOCK_SIZE);
@@ -298,7 +298,7 @@ namespace FLAC {
                        object_->data.stream_info.min_blocksize = value;
                }
 
-               void StreamInfo::set_max_blocksize(unsigned value)
+               void StreamInfo::set_max_blocksize(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(value >= FLAC__MIN_BLOCK_SIZE);
@@ -306,28 +306,28 @@ namespace FLAC {
                        object_->data.stream_info.max_blocksize = value;
                }
 
-               void StreamInfo::set_min_framesize(unsigned value)
+               void StreamInfo::set_min_framesize(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(value < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN));
                        object_->data.stream_info.min_framesize = value;
                }
 
-               void StreamInfo::set_max_framesize(unsigned value)
+               void StreamInfo::set_max_framesize(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(value < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN));
                        object_->data.stream_info.max_framesize = value;
                }
 
-               void StreamInfo::set_sample_rate(unsigned value)
+               void StreamInfo::set_sample_rate(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(FLAC__format_sample_rate_is_valid(value));
                        object_->data.stream_info.sample_rate = value;
                }
 
-               void StreamInfo::set_channels(unsigned value)
+               void StreamInfo::set_channels(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(value > 0);
@@ -335,7 +335,7 @@ namespace FLAC {
                        object_->data.stream_info.channels = value;
                }
 
-               void StreamInfo::set_bits_per_sample(unsigned value)
+               void StreamInfo::set_bits_per_sample(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(value >= FLAC__MIN_BITS_PER_SAMPLE);
@@ -366,7 +366,7 @@ namespace FLAC {
                Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING), /*copy=*/false)
                { }
 
-               Padding::Padding(unsigned length):
+               Padding::Padding(uint32_t length):
                Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING), /*copy=*/false)
                {
                        set_length(length);
@@ -375,7 +375,7 @@ namespace FLAC {
                Padding::~Padding()
                { }
 
-               void Padding::set_length(unsigned length)
+               void Padding::set_length(uint32_t length)
                {
                        FLAC__ASSERT(is_valid());
                        object_->length = length;
@@ -412,13 +412,13 @@ namespace FLAC {
                        memcpy(object_->data.application.id, value, 4);
                }
 
-               bool Application::set_data(const FLAC__byte *data, unsigned length)
+               bool Application::set_data(const FLAC__byte *data, uint32_t length)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_application_set_data(object_, (FLAC__byte*)data, length, true);
                }
 
-               bool Application::set_data(FLAC__byte *data, unsigned length, bool copy)
+               bool Application::set_data(FLAC__byte *data, uint32_t length, bool copy)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_application_set_data(object_, data, length, copy);
@@ -436,40 +436,40 @@ namespace FLAC {
                SeekTable::~SeekTable()
                { }
 
-               unsigned SeekTable::get_num_points() const
+               uint32_t SeekTable::get_num_points() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.seek_table.num_points;
                }
 
-               ::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(unsigned indx) const
+               ::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(uint32_t indx) const
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx < object_->data.seek_table.num_points);
                        return object_->data.seek_table.points[indx];
                }
 
-               bool SeekTable::resize_points(unsigned new_num_points)
+               bool SeekTable::resize_points(uint32_t new_num_points)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_seektable_resize_points(object_, new_num_points);
                }
 
-               void SeekTable::set_point(unsigned indx, const ::FLAC__StreamMetadata_SeekPoint &point)
+               void SeekTable::set_point(uint32_t indx, const ::FLAC__StreamMetadata_SeekPoint &point)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx < object_->data.seek_table.num_points);
                        ::FLAC__metadata_object_seektable_set_point(object_, indx, point);
                }
 
-               bool SeekTable::insert_point(unsigned indx, const ::FLAC__StreamMetadata_SeekPoint &point)
+               bool SeekTable::insert_point(uint32_t indx, const ::FLAC__StreamMetadata_SeekPoint &point)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx <= object_->data.seek_table.num_points);
                        return (bool)::FLAC__metadata_object_seektable_insert_point(object_, indx, point);
                }
 
-               bool SeekTable::delete_point(unsigned indx)
+               bool SeekTable::delete_point(uint32_t indx)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx < object_->data.seek_table.num_points);
@@ -482,7 +482,7 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_seektable_is_legal(object_);
                }
 
-               bool SeekTable::template_append_placeholders(unsigned num)
+               bool SeekTable::template_append_placeholders(uint32_t num)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_seektable_template_append_placeholders(object_, num);
@@ -494,19 +494,19 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_seektable_template_append_point(object_, sample_number);
                }
 
-               bool SeekTable::template_append_points(FLAC__uint64 sample_numbers[], unsigned num)
+               bool SeekTable::template_append_points(FLAC__uint64 sample_numbers[], uint32_t num)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_seektable_template_append_points(object_, sample_numbers, num);
                }
 
-               bool SeekTable::template_append_spaced_points(unsigned num, FLAC__uint64 total_samples)
+               bool SeekTable::template_append_spaced_points(uint32_t num, FLAC__uint64 total_samples)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_seektable_template_append_spaced_points(object_, num, total_samples);
                }
 
-               bool SeekTable::template_append_spaced_points_by_samples(unsigned samples, FLAC__uint64 total_samples)
+               bool SeekTable::template_append_spaced_points_by_samples(uint32_t samples, FLAC__uint64 total_samples)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(object_, samples, total_samples);
@@ -534,7 +534,7 @@ namespace FLAC {
                        zero();
                }
 
-               VorbisComment::Entry::Entry(const char *field, unsigned field_length) :
+               VorbisComment::Entry::Entry(const char *field, uint32_t field_length) :
                        is_valid_(true),
                        entry_(),
                        field_name_(0),
@@ -558,7 +558,7 @@ namespace FLAC {
                        construct(field);
                }
 
-               VorbisComment::Entry::Entry(const char *field_name, const char *field_value, unsigned field_value_length) :
+               VorbisComment::Entry::Entry(const char *field_name, const char *field_value, uint32_t field_value_length) :
                        is_valid_(true),
                        entry_(),
                        field_name_(0),
@@ -613,19 +613,19 @@ namespace FLAC {
                        return is_valid_;
                }
 
-               unsigned VorbisComment::Entry::get_field_length() const
+               uint32_t VorbisComment::Entry::get_field_length() const
                {
                        FLAC__ASSERT(is_valid());
                        return entry_.length;
                }
 
-               unsigned VorbisComment::Entry::get_field_name_length() const
+               uint32_t VorbisComment::Entry::get_field_name_length() const
                {
                        FLAC__ASSERT(is_valid());
                        return field_name_length_;
                }
 
-               unsigned VorbisComment::Entry::get_field_value_length() const
+               uint32_t VorbisComment::Entry::get_field_value_length() const
                {
                        FLAC__ASSERT(is_valid());
                        return field_value_length_;
@@ -655,7 +655,7 @@ namespace FLAC {
                        return field_value_;
                }
 
-               bool VorbisComment::Entry::set_field(const char *field, unsigned field_length)
+               bool VorbisComment::Entry::set_field(const char *field, uint32_t field_length)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(0 != field);
@@ -704,7 +704,7 @@ namespace FLAC {
                        return is_valid_;
                }
 
-               bool VorbisComment::Entry::set_field_value(const char *field_value, unsigned field_value_length)
+               bool VorbisComment::Entry::set_field_value(const char *field_value, uint32_t field_value_length)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(0 != field_value);
@@ -778,7 +778,7 @@ namespace FLAC {
                        }
                }
 
-               void VorbisComment::Entry::construct(const char *field, unsigned field_length)
+               void VorbisComment::Entry::construct(const char *field, uint32_t field_length)
                {
                        if(set_field(field, field_length))
                                parse_field();
@@ -789,7 +789,7 @@ namespace FLAC {
                        construct(field, strlen(field));
                }
 
-               void VorbisComment::Entry::construct(const char *field_name, const char *field_value, unsigned field_value_length)
+               void VorbisComment::Entry::construct(const char *field_name, const char *field_value, uint32_t field_value_length)
                {
                        if(set_field_name(field_name) && set_field_value(field_value, field_value_length))
                                compose_field();
@@ -830,7 +830,7 @@ namespace FLAC {
                        if(0 == p)
                                p = (const char *)entry_.entry + entry_.length;
 
-                       field_name_length_ = (unsigned)(p - (const char *)entry_.entry);
+                       field_name_length_ = (uint32_t)(p - (const char *)entry_.entry);
                        if(0 == (field_name_ = (char *)safe_malloc_add_2op_(field_name_length_, /*+*/1))) { // +1 for the trailing \0
                                is_valid_ = false;
                                return;
@@ -870,7 +870,7 @@ namespace FLAC {
                VorbisComment::~VorbisComment()
                { }
 
-               unsigned VorbisComment::get_num_comments() const
+               uint32_t VorbisComment::get_num_comments() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.vorbis_comment.num_comments;
@@ -882,7 +882,7 @@ namespace FLAC {
                        return object_->data.vorbis_comment.vendor_string.entry;
                }
 
-               VorbisComment::Entry VorbisComment::get_comment(unsigned indx) const
+               VorbisComment::Entry VorbisComment::get_comment(uint32_t indx) const
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments);
@@ -897,20 +897,20 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, vendor_string, /*copy=*/true);
                }
 
-               bool VorbisComment::resize_comments(unsigned new_num_comments)
+               bool VorbisComment::resize_comments(uint32_t new_num_comments)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_vorbiscomment_resize_comments(object_, new_num_comments);
                }
 
-               bool VorbisComment::set_comment(unsigned indx, const VorbisComment::Entry &entry)
+               bool VorbisComment::set_comment(uint32_t indx, const VorbisComment::Entry &entry)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments);
                        return (bool)::FLAC__metadata_object_vorbiscomment_set_comment(object_, indx, entry.get_entry(), /*copy=*/true);
                }
 
-               bool VorbisComment::insert_comment(unsigned indx, const VorbisComment::Entry &entry)
+               bool VorbisComment::insert_comment(uint32_t indx, const VorbisComment::Entry &entry)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx <= object_->data.vorbis_comment.num_comments);
@@ -929,14 +929,14 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_vorbiscomment_replace_comment(object_, entry.get_entry(), all, /*copy=*/true);
                }
 
-               bool VorbisComment::delete_comment(unsigned indx)
+               bool VorbisComment::delete_comment(uint32_t indx)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments);
                        return (bool)::FLAC__metadata_object_vorbiscomment_delete_comment(object_, indx);
                }
 
-               int VorbisComment::find_entry_from(unsigned offset, const char *field_name)
+               int VorbisComment::find_entry_from(uint32_t offset, const char *field_name)
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__metadata_object_vorbiscomment_find_entry_from(object_, offset, field_name);
@@ -990,7 +990,7 @@ namespace FLAC {
                        return(0 != object_);
                }
 
-               ::FLAC__StreamMetadata_CueSheet_Index CueSheet::Track::get_index(unsigned i) const
+               ::FLAC__StreamMetadata_CueSheet_Index CueSheet::Track::get_index(uint32_t i) const
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(i < object_->num_indices);
@@ -1005,14 +1005,14 @@ namespace FLAC {
                        object_->isrc[12] = '\0';
                }
 
-               void CueSheet::Track::set_type(unsigned value)
+               void CueSheet::Track::set_type(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(value <= 1);
                        object_->type = value;
                }
 
-               void CueSheet::Track::set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
+               void CueSheet::Track::set_index(uint32_t i, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(i < object_->num_indices);
@@ -1049,13 +1049,13 @@ namespace FLAC {
                        return object_->data.cue_sheet.is_cd? true : false;
                }
 
-               unsigned CueSheet::get_num_tracks() const
+               uint32_t CueSheet::get_num_tracks() const
                {
                        FLAC__ASSERT(is_valid());
                        return object_->data.cue_sheet.num_tracks;
                }
 
-               CueSheet::Track CueSheet::get_track(unsigned i) const
+               CueSheet::Track CueSheet::get_track(uint32_t i) const
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks);
@@ -1082,7 +1082,7 @@ namespace FLAC {
                        object_->data.cue_sheet.is_cd = value;
                }
 
-               void CueSheet::set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
+               void CueSheet::set_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks);
@@ -1090,14 +1090,14 @@ namespace FLAC {
                        object_->data.cue_sheet.tracks[track_num].indices[index_num] = indx;
                }
 
-               bool CueSheet::resize_indices(unsigned track_num, unsigned new_num_indices)
+               bool CueSheet::resize_indices(uint32_t track_num, uint32_t new_num_indices)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks);
                        return (bool)::FLAC__metadata_object_cuesheet_track_resize_indices(object_, track_num, new_num_indices);
                }
 
-               bool CueSheet::insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
+               bool CueSheet::insert_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks);
@@ -1105,7 +1105,7 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_cuesheet_track_insert_index(object_, track_num, index_num, indx);
                }
 
-               bool CueSheet::insert_blank_index(unsigned track_num, unsigned index_num)
+               bool CueSheet::insert_blank_index(uint32_t track_num, uint32_t index_num)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks);
@@ -1113,7 +1113,7 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_cuesheet_track_insert_blank_index(object_, track_num, index_num);
                }
 
-               bool CueSheet::delete_index(unsigned track_num, unsigned index_num)
+               bool CueSheet::delete_index(uint32_t track_num, uint32_t index_num)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks);
@@ -1121,13 +1121,13 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_cuesheet_track_delete_index(object_, track_num, index_num);
                }
 
-               bool CueSheet::resize_tracks(unsigned new_num_tracks)
+               bool CueSheet::resize_tracks(uint32_t new_num_tracks)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_cuesheet_resize_tracks(object_, new_num_tracks);
                }
 
-               bool CueSheet::set_track(unsigned i, const CueSheet::Track &track)
+               bool CueSheet::set_track(uint32_t i, const CueSheet::Track &track)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks);
@@ -1135,7 +1135,7 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_cuesheet_set_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true);
                }
 
-               bool CueSheet::insert_track(unsigned i, const CueSheet::Track &track)
+               bool CueSheet::insert_track(uint32_t i, const CueSheet::Track &track)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(i <= object_->data.cue_sheet.num_tracks);
@@ -1143,14 +1143,14 @@ namespace FLAC {
                        return (bool)::FLAC__metadata_object_cuesheet_insert_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true);
                }
 
-               bool CueSheet::insert_blank_track(unsigned i)
+               bool CueSheet::insert_blank_track(uint32_t i)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(i <= object_->data.cue_sheet.num_tracks);
                        return (bool)::FLAC__metadata_object_cuesheet_insert_blank_track(object_, i);
                }
 
-               bool CueSheet::delete_track(unsigned i)
+               bool CueSheet::delete_track(uint32_t i)
                {
                        FLAC__ASSERT(is_valid());
                        FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks);
@@ -1310,13 +1310,13 @@ namespace FLAC {
                        return object_->data.application.data;
                }
 
-               bool Unknown::set_data(const FLAC__byte *data, unsigned length)
+               bool Unknown::set_data(const FLAC__byte *data, uint32_t length)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_application_set_data(object_, (FLAC__byte*)data, length, true);
                }
 
-               bool Unknown::set_data(FLAC__byte *data, unsigned length, bool copy)
+               bool Unknown::set_data(FLAC__byte *data, uint32_t length, bool copy)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__metadata_object_application_set_data(object_, data, length, copy);
@@ -1403,7 +1403,7 @@ namespace FLAC {
                                return false;
                }
 
-               FLACPP_API bool get_picture(const char *filename, Picture *&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)
+               FLACPP_API bool get_picture(const char *filename, Picture *&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__ASSERT(0 != filename);
 
@@ -1419,7 +1419,7 @@ namespace FLAC {
                                return false;
                }
 
-               FLACPP_API bool get_picture(const char *filename, Picture &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)
+               FLACPP_API bool get_picture(const char *filename, Picture &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__ASSERT(0 != filename);
 
@@ -1513,7 +1513,7 @@ namespace FLAC {
                }
 
                //@@@@ add to tests
-               unsigned SimpleIterator::get_block_length() const
+               uint32_t SimpleIterator::get_block_length() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__metadata_simple_iterator_get_block_length(iterator_);
index 8ab3981..c296944 100644 (file)
@@ -134,7 +134,7 @@ namespace FLAC {
                        return ::FLAC__stream_decoder_get_total_samples(decoder_);
                }
 
-               unsigned Stream::get_channels() const
+               uint32_t Stream::get_channels() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_decoder_get_channels(decoder_);
@@ -146,19 +146,19 @@ namespace FLAC {
                        return ::FLAC__stream_decoder_get_channel_assignment(decoder_);
                }
 
-               unsigned Stream::get_bits_per_sample() const
+               uint32_t Stream::get_bits_per_sample() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_decoder_get_bits_per_sample(decoder_);
                }
 
-               unsigned Stream::get_sample_rate() const
+               uint32_t Stream::get_sample_rate() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_decoder_get_sample_rate(decoder_);
                }
 
-               unsigned Stream::get_blocksize() const
+               uint32_t Stream::get_blocksize() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_decoder_get_blocksize(decoder_);
index 9466ea8..3b08192 100644 (file)
@@ -87,31 +87,31 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_set_streamable_subset(encoder_, value);
                }
 
-               bool Stream::set_channels(unsigned value)
+               bool Stream::set_channels(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_channels(encoder_, value);
                }
 
-               bool Stream::set_bits_per_sample(unsigned value)
+               bool Stream::set_bits_per_sample(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_bits_per_sample(encoder_, value);
                }
 
-               bool Stream::set_sample_rate(unsigned value)
+               bool Stream::set_sample_rate(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_sample_rate(encoder_, value);
                }
 
-               bool Stream::set_compression_level(unsigned value)
+               bool Stream::set_compression_level(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_compression_level(encoder_, value);
                }
 
-               bool Stream::set_blocksize(unsigned value)
+               bool Stream::set_blocksize(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_blocksize(encoder_, value);
@@ -135,13 +135,13 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_set_apodization(encoder_, specification);
                }
 
-               bool Stream::set_max_lpc_order(unsigned value)
+               bool Stream::set_max_lpc_order(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_max_lpc_order(encoder_, value);
                }
 
-               bool Stream::set_qlp_coeff_precision(unsigned value)
+               bool Stream::set_qlp_coeff_precision(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value);
@@ -165,19 +165,19 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value);
                }
 
-               bool Stream::set_min_residual_partition_order(unsigned value)
+               bool Stream::set_min_residual_partition_order(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value);
                }
 
-               bool Stream::set_max_residual_partition_order(unsigned value)
+               bool Stream::set_max_residual_partition_order(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value);
                }
 
-               bool Stream::set_rice_parameter_search_dist(unsigned value)
+               bool Stream::set_rice_parameter_search_dist(uint32_t value)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value);
@@ -189,13 +189,13 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value);
                }
 
-               bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks)
+               bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, uint32_t num_blocks)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks);
                }
 
-               bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
+               bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, uint32_t num_blocks)
                {
                        FLAC__ASSERT(is_valid());
 #ifndef HAVE_CXX_VARARRAYS
@@ -206,7 +206,7 @@ namespace FLAC {
 #else
                        ::FLAC__StreamMetadata *m[num_blocks];
 #endif
-                       for(unsigned i = 0; i < num_blocks; i++) {
+                       for(uint32_t i = 0; i < num_blocks; i++) {
                                // we can get away with the const_cast since we know the encoder will only correct the is_last flags
                                m[i] = const_cast< ::FLAC__StreamMetadata*>(static_cast<const ::FLAC__StreamMetadata*>(*metadata[i]));
                        }
@@ -232,7 +232,7 @@ namespace FLAC {
                        return Decoder::Stream::State(::FLAC__stream_encoder_get_verify_decoder_state(encoder_));
                }
 
-               void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
+               void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got)
                {
                        FLAC__ASSERT(is_valid());
                        ::FLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got);
@@ -262,37 +262,37 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_);
                }
 
-               unsigned Stream::get_channels() const
+               uint32_t Stream::get_channels() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_channels(encoder_);
                }
 
-               unsigned Stream::get_bits_per_sample() const
+               uint32_t Stream::get_bits_per_sample() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_bits_per_sample(encoder_);
                }
 
-               unsigned Stream::get_sample_rate() const
+               uint32_t Stream::get_sample_rate() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_sample_rate(encoder_);
                }
 
-               unsigned Stream::get_blocksize() const
+               uint32_t Stream::get_blocksize() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_blocksize(encoder_);
                }
 
-               unsigned Stream::get_max_lpc_order() const
+               uint32_t Stream::get_max_lpc_order() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_max_lpc_order(encoder_);
                }
 
-               unsigned Stream::get_qlp_coeff_precision() const
+               uint32_t Stream::get_qlp_coeff_precision() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_qlp_coeff_precision(encoder_);
@@ -316,19 +316,19 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_);
                }
 
-               unsigned Stream::get_min_residual_partition_order() const
+               uint32_t Stream::get_min_residual_partition_order() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_min_residual_partition_order(encoder_);
                }
 
-               unsigned Stream::get_max_residual_partition_order() const
+               uint32_t Stream::get_max_residual_partition_order() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_max_residual_partition_order(encoder_);
                }
 
-               unsigned Stream::get_rice_parameter_search_dist() const
+               uint32_t Stream::get_rice_parameter_search_dist() const
                {
                        FLAC__ASSERT(is_valid());
                        return ::FLAC__stream_encoder_get_rice_parameter_search_dist(encoder_);
@@ -358,13 +358,13 @@ namespace FLAC {
                        return (bool)::FLAC__stream_encoder_finish(encoder_);
                }
 
-               bool Stream::process(const FLAC__int32 * const buffer[], unsigned samples)
+               bool Stream::process(const FLAC__int32 * const buffer[], uint32_t samples)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_process(encoder_, buffer, samples);
                }
 
-               bool Stream::process_interleaved(const FLAC__int32 buffer[], unsigned samples)
+               bool Stream::process_interleaved(const FLAC__int32 buffer[], uint32_t samples)
                {
                        FLAC__ASSERT(is_valid());
                        return (bool)::FLAC__stream_encoder_process_interleaved(encoder_, buffer, samples);
@@ -402,7 +402,7 @@ namespace FLAC {
                        return instance->read_callback(buffer, bytes);
                }
 
-               ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data)
+               ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data)
                {
                        (void)encoder;
                        FLAC__ASSERT(0 != client_data);
@@ -491,19 +491,19 @@ namespace FLAC {
                // with FLAC__stream_decoder_init_FILE() or
                // FLAC__stream_decoder_init_file() and those supply the read
                // callback internally.
-               ::FLAC__StreamEncoderWriteStatus File::write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame)
+               ::FLAC__StreamEncoderWriteStatus File::write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame)
                {
                        (void)buffer, (void)bytes, (void)samples, (void)current_frame;
                        FLAC__ASSERT(false);
                        return ::FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; // double protection
                }
 
-               void File::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate)
+               void File::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate)
                {
                        (void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate;
                }
 
-               void File::progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data)
+               void File::progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data)
                {
                        (void)encoder;
                        FLAC__ASSERT(0 != client_data);
index 81e585a..585a5db 100644 (file)
@@ -84,7 +84,7 @@ FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, uint3
 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, uint32_t parameter);
-FLAC__bool FLAC__bitreader_read_golomb_uint32_t(FLAC__BitReader *br, uint32_t *val, uint32_t parameter);
+FLAC__bool FLAC__bitreader_read_golomb_unsigned(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, uint32_t *rawlen);
 FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, uint32_t *rawlen);
index d1aa094..672f282 100644 (file)
@@ -89,13 +89,13 @@ FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, uint32_t va
 uint32_t FLAC__bitwriter_rice_bits(FLAC__int32 val, uint32_t parameter);
 #if 0 /* UNUSED */
 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);
+uint32_t FLAC__bitwriter_golomb_bits_unsigned(uint32_t val, uint32_t parameter);
 #endif
 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, uint32_t parameter);
-FLAC__bool FLAC__bitwriter_write_golomb_uint32_t(FLAC__BitWriter *bw, uint32_t val, uint32_t parameter);
+FLAC__bool FLAC__bitwriter_write_golomb_unsigned(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 eca81b5..b1505ee 100644 (file)
@@ -57,7 +57,7 @@ static const char * const LayerString[] = {
 
 static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_;
 static ::FLAC__StreamMetadata *expected_metadata_sequence_[9];
-static unsigned num_expected_;
+static uint32_t num_expected_;
 static FLAC__off_t flacfilesize_;
 
 static const char *flacfilename(bool is_ogg)
@@ -80,7 +80,7 @@ static FLAC__bool die_s_(const char *msg, const FLAC::Decoder::Stream *decoder)
        else
                printf("FAILED");
 
-       printf(", state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+       printf(", state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring());
 
        return false;
 }
@@ -120,7 +120,7 @@ static bool generate_file_(FLAC__bool is_ogg)
 class DecoderCommon {
 public:
        Layer layer_;
-       unsigned current_metadata_number_;
+       uint32_t current_metadata_number_;
        bool ignore_errors_;
        bool error_occurred_;
 
@@ -171,7 +171,7 @@ void DecoderCommon::common_metadata_callback_(const ::FLAC__StreamMetadata *meta
 void DecoderCommon::common_error_callback_(::FLAC__StreamDecoderErrorStatus status)
 {
        if(!ignore_errors_) {
-               printf("ERROR: got error callback: err = %u (%s)\n", (unsigned)status, ::FLAC__StreamDecoderErrorStatusString[status]);
+               printf("ERROR: got error callback: err = %u (%s)\n", (uint32_t)status, ::FLAC__StreamDecoderErrorStatusString[status]);
                error_occurred_ = true;
        }
 }
@@ -326,7 +326,7 @@ bool StreamDecoder::test_respond(bool is_ogg)
        printf("testing process_until_end_of_stream()... ");
        if(!process_until_end_of_stream()) {
                State state = get_state();
-               printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+               printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring());
                return false;
        }
        printf("OK\n");
@@ -334,7 +334,7 @@ bool StreamDecoder::test_respond(bool is_ogg)
        printf("testing finish()... ");
        if(!finish()) {
                State state = get_state();
-               printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+               printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring());
                return false;
        }
        printf("OK\n");
@@ -412,7 +412,7 @@ bool FileDecoder::test_respond(bool is_ogg)
        printf("testing process_until_end_of_stream()... ");
        if(!process_until_end_of_stream()) {
                State state = get_state();
-               printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+               printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring());
                return false;
        }
        printf("OK\n");
@@ -420,7 +420,7 @@ bool FileDecoder::test_respond(bool is_ogg)
        printf("testing finish()... ");
        if(!finish()) {
                State state = get_state();
-               printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+               printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring());
                return false;
        }
        printf("OK\n");
@@ -594,7 +594,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
 
        printf("testing get_state()... ");
        FLAC::Decoder::Stream::State state = decoder->get_state();
-       printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+       printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring());
 
        dynamic_cast<DecoderCommon*>(decoder)->current_metadata_number_ = 0;
        dynamic_cast<DecoderCommon*>(decoder)->ignore_errors_ = false;
@@ -655,7 +655,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
 
        printf("testing get_channels()... ");
        {
-               unsigned channels = decoder->get_channels();
+               uint32_t channels = decoder->get_channels();
                if(channels != streaminfo_.data.stream_info.channels) {
                        printf("FAILED, returned %u, expected %u\n", channels, streaminfo_.data.stream_info.channels);
                        return false;
@@ -665,7 +665,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
 
        printf("testing get_bits_per_sample()... ");
        {
-               unsigned bits_per_sample = decoder->get_bits_per_sample();
+               uint32_t bits_per_sample = decoder->get_bits_per_sample();
                if(bits_per_sample != streaminfo_.data.stream_info.bits_per_sample) {
                        printf("FAILED, returned %u, expected %u\n", bits_per_sample, streaminfo_.data.stream_info.bits_per_sample);
                        return false;
@@ -675,7 +675,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
 
        printf("testing get_sample_rate()... ");
        {
-               unsigned sample_rate = decoder->get_sample_rate();
+               uint32_t sample_rate = decoder->get_sample_rate();
                if(sample_rate != streaminfo_.data.stream_info.sample_rate) {
                        printf("FAILED, returned %u, expected %u\n", sample_rate, streaminfo_.data.stream_info.sample_rate);
                        return false;
@@ -685,7 +685,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
 
        printf("testing get_blocksize()... ");
        {
-               unsigned blocksize = decoder->get_blocksize();
+               uint32_t blocksize = decoder->get_blocksize();
                /* value could be anything since we're at the last block, so accept any reasonable answer */
                printf("returned %u... %s\n", blocksize, blocksize>0? "OK" : "FAILED");
                if(blocksize == 0)
@@ -695,7 +695,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
        printf("testing get_channel_assignment()... ");
        {
                ::FLAC__ChannelAssignment ca = decoder->get_channel_assignment();
-               printf("returned %u (%s)... OK\n", (unsigned)ca, ::FLAC__ChannelAssignmentString[ca]);
+               printf("returned %u (%s)... OK\n", (uint32_t)ca, ::FLAC__ChannelAssignmentString[ca]);
        }
 
        if(layer < LAYER_FILE) {
@@ -725,7 +725,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
        printf("testing finish()... ");
        if(!decoder->finish()) {
                state = decoder->get_state();
-               printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
+               printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring());
                return false;
        }
        printf("OK\n");
index bafe0d4..277e129 100644 (file)
@@ -56,7 +56,7 @@ static const char * const LayerString[] = {
 
 static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_;
 static ::FLAC__StreamMetadata *metadata_sequence_[] = { &vorbiscomment_, &padding_, &seektable_, &application1_, &application2_, &cuesheet_, &picture_, &unknown_ };
-static const unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]);
+static const uint32_t num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]);
 
 static const char *flacfilename(bool is_ogg)
 {
@@ -78,10 +78,10 @@ static bool die_s_(const char *msg, const FLAC::Encoder::Stream *encoder)
        else
                printf("FAILED");
 
-       printf(", state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state), state.as_cstring());
+       printf(", state = %u (%s)\n", (uint32_t)((::FLAC__StreamEncoderState)state), state.as_cstring());
        if(state == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) {
                FLAC::Decoder::Stream::State dstate = encoder->get_verify_decoder_state();
-               printf("      verify decoder state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring());
+               printf("      verify decoder state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring());
        }
 
        return false;
@@ -107,7 +107,7 @@ public:
 
        // from FLAC::Encoder::Stream
        ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes);
-       ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame);
+       ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame);
        ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
        ::FLAC__StreamEncoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset);
        void metadata_callback(const ::FLAC__StreamMetadata *metadata);
@@ -131,7 +131,7 @@ private:
                return ::FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
 }
 
-::FLAC__StreamEncoderWriteStatus StreamEncoder::write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame)
+::FLAC__StreamEncoderWriteStatus StreamEncoder::write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame)
 {
        (void)samples, (void)current_frame;
 
@@ -177,10 +177,10 @@ public:
        ~FileEncoder() { }
 
        // from FLAC::Encoder::File
-       void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate);
+       void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate);
 };
 
-void FileEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate)
+void FileEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate)
 {
        (void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate;
 }
@@ -200,7 +200,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg)
        FILE *file = 0;
        FLAC__int32 samples[1024];
        FLAC__int32 *samples_array[1] = { samples };
-       unsigned i;
+       uint32_t i;
 
        printf("\n+++ libFLAC++ unit test: FLAC::Encoder::%s (layer: %s, format: %s)\n\n", layer<LAYER_FILE? "Stream":"File", LayerString[layer], is_ogg? "Ogg FLAC":"FLAC");
 
@@ -252,7 +252,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg)
        printf("OK\n");
 
        printf("testing set_compression_level()... ");
-       if(!encoder->set_compression_level((unsigned)(-1)))
+       if(!encoder->set_compression_level((uint32_t)(-1)))
                return die_s_("returned false", encoder);
        printf("OK\n");
 
@@ -361,17 +361,17 @@ static bool test_stream_encoder(Layer layer, bool is_ogg)
 
        printf("testing get_state()... ");
        FLAC::Encoder::Stream::State state = encoder->get_state();
-       printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamEncoderState)state), state.as_cstring());
+       printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamEncoderState)state), state.as_cstring());
 
        printf("testing get_verify_decoder_state()... ");
        FLAC::Decoder::Stream::State dstate = encoder->get_verify_decoder_state();
-       printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring());
+       printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring());
 
        {
                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;
 
@@ -514,7 +514,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg)
        printf("testing finish()... ");
        if(!encoder->finish()) {
                state = encoder->get_state();
-               printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state), state.as_cstring());
+               printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamEncoderState)state), state.as_cstring());
                return false;
        }
        printf("OK\n");
index 9a29093..a7aaf91 100644 (file)
@@ -70,14 +70,14 @@ protected:
 
 struct OurMetadata {
        FLAC::Metadata::Prototype *blocks[64];
-       unsigned num_blocks;
+       uint32_t num_blocks;
 };
 
 /* our copy of the metadata in flacfilename() */
 static OurMetadata our_metadata_;
 
 /* the current block number that corresponds to the position of the iterator we are testing */
-static unsigned mc_our_block_number_ = 0;
+static uint32_t mc_our_block_number_ = 0;
 
 static const char *flacfilename(bool is_ogg)
 {
@@ -93,7 +93,7 @@ static bool die_(const char *msg)
 static bool die_c_(const char *msg, FLAC::Metadata::Chain::Status status)
 {
        printf("ERROR: %s\n", msg);
-       printf("       status=%u (%s)\n", (unsigned)((::FLAC__Metadata_ChainStatus)status), status.as_cstring());
+       printf("       status=%u (%s)\n", (uint32_t)((::FLAC__Metadata_ChainStatus)status), status.as_cstring());
        return false;
 }
 
@@ -101,7 +101,7 @@ static bool die_ss_(const char *msg, FLAC::Metadata::SimpleIterator &iterator)
 {
        const FLAC::Metadata::SimpleIterator::Status status = iterator.status();
        printf("ERROR: %s\n", msg);
-       printf("       status=%u (%s)\n", (unsigned)((::FLAC__Metadata_SimpleIteratorStatus)status), status.as_cstring());
+       printf("       status=%u (%s)\n", (uint32_t)((::FLAC__Metadata_SimpleIteratorStatus)status), status.as_cstring());
        return false;
 }
 
@@ -109,7 +109,7 @@ static void *malloc_or_die_(size_t size)
 {
        void *x = malloc(size);
        if(0 == x) {
-               fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (unsigned)size);
+               fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size);
                exit(1);
        }
        return x;
@@ -127,9 +127,9 @@ static char *strdup_or_die_(const char *s)
 
 /* functions for working with our metadata copy */
 
-static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, unsigned position, bool copy)
+static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, uint32_t position, bool copy)
 {
-       unsigned i;
+       uint32_t i;
        FLAC::Metadata::Prototype *obj = block;
        FLAC__ASSERT(position < our_metadata_.num_blocks);
        if(copy) {
@@ -147,9 +147,9 @@ static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, unsigned
        return true;
 }
 
-static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, unsigned position, bool copy)
+static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, uint32_t position, bool copy)
 {
-       unsigned i;
+       uint32_t i;
        FLAC::Metadata::Prototype *obj = block;
        if(copy) {
                if(0 == (obj = FLAC::Metadata::clone(block)))
@@ -173,9 +173,9 @@ static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, unsigned p
        return true;
 }
 
-static void delete_from_our_metadata_(unsigned position)
+static void delete_from_our_metadata_(uint32_t position)
 {
-       unsigned i;
+       uint32_t i;
        FLAC__ASSERT(position < our_metadata_.num_blocks);
        delete our_metadata_.blocks[position];
        for(i = position; i < our_metadata_.num_blocks - 1; i++)
@@ -190,11 +190,11 @@ static void delete_from_our_metadata_(unsigned position)
        }
 }
 
-void add_to_padding_length_(unsigned indx, int delta)
+void add_to_padding_length_(uint32_t indx, int delta)
 {
        FLAC::Metadata::Padding *padding = dynamic_cast<FLAC::Metadata::Padding *>(our_metadata_.blocks[indx]);
        FLAC__ASSERT(0 != padding);
-       padding->set_length((unsigned)((int)padding->get_length() + delta));
+       padding->set_length((uint32_t)((int)padding->get_length() + delta));
 }
 
 /*
@@ -398,9 +398,9 @@ static bool read_chain_(FLAC::Metadata::Chain &chain, const char *filename, bool
 
 /* function for comparing our metadata to a FLAC::Metadata::Chain */
 
-static bool compare_chain_(FLAC::Metadata::Chain &chain, unsigned current_position, FLAC::Metadata::Prototype *current_block)
+static bool compare_chain_(FLAC::Metadata::Chain &chain, uint32_t current_position, FLAC::Metadata::Prototype *current_block)
 {
-       unsigned i;
+       uint32_t i;
        FLAC::Metadata::Iterator iterator;
        bool next_ok = true;
 
@@ -492,14 +492,14 @@ void OurFileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata)
 void OurFileDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status)
 {
        error_occurred_ = true;
-       printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (unsigned)status);
+       printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (uint32_t)status);
 }
 
 static bool generate_file_(bool include_extras, bool is_ogg)
 {
        ::FLAC__StreamMetadata streaminfo, vorbiscomment, *cuesheet, picture, padding;
        ::FLAC__StreamMetadata *metadata[4];
-       unsigned i = 0, n = 0;
+       uint32_t i = 0, n = 0;
 
        printf("generating %sFLAC file for test\n", is_ogg? "Ogg " : "");
 
@@ -520,7 +520,7 @@ static bool generate_file_(bool include_extras, bool is_ogg)
        memset(streaminfo.data.stream_info.md5sum, 0, 16);
 
        {
-               const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING);
+               const uint32_t vendor_string_length = (uint32_t)strlen(FLAC__VENDOR_STRING);
                vorbiscomment.is_last = false;
                vorbiscomment.type = ::FLAC__METADATA_TYPE_VORBIS_COMMENT;
                vorbiscomment.length = (4 + vendor_string_length) + 4;
@@ -766,7 +766,7 @@ static bool test_level_0_()
 
                FLAC::Metadata::Picture *picture = 0;
 
-               if(!FLAC::Metadata::get_picture(flacfilename(/*is_ogg=*/false), picture, /*type=*/(::FLAC__StreamMetadata_Picture_Type)(-1), /*mime_type=*/0, /*description=*/0, /*max_width=*/(unsigned)(-1), /*max_height=*/(unsigned)(-1), /*max_depth=*/(unsigned)(-1), /*max_colors=*/(unsigned)(-1)))
+               if(!FLAC::Metadata::get_picture(flacfilename(/*is_ogg=*/false), picture, /*type=*/(::FLAC__StreamMetadata_Picture_Type)(-1), /*mime_type=*/0, /*description=*/0, /*max_width=*/(uint32_t)(-1), /*max_height=*/(uint32_t)(-1), /*max_depth=*/(uint32_t)(-1), /*max_colors=*/(uint32_t)(-1)))
                        return die_("during FLAC::Metadata::get_picture()");
 
                /* check to see if some basic data matches (c.f. generate_file_()) */
@@ -783,7 +783,7 @@ static bool test_level_0_()
 
                FLAC::Metadata::Picture picture;
 
-               if(!FLAC::Metadata::get_picture(flacfilename(/*is_ogg=*/false), picture, /*type=*/(::FLAC__StreamMetadata_Picture_Type)(-1), /*mime_type=*/0, /*description=*/0, /*max_width=*/(unsigned)(-1), /*max_height=*/(unsigned)(-1), /*max_depth=*/(unsigned)(-1), /*max_colors=*/(unsigned)(-1)))
+               if(!FLAC::Metadata::get_picture(flacfilename(/*is_ogg=*/false), picture, /*type=*/(::FLAC__StreamMetadata_Picture_Type)(-1), /*mime_type=*/0, /*description=*/0, /*max_width=*/(uint32_t)(-1), /*max_height=*/(uint32_t)(-1), /*max_depth=*/(uint32_t)(-1), /*max_colors=*/(uint32_t)(-1)))
                        return die_("during FLAC::Metadata::get_picture()");
 
                /* check to see if some basic data matches (c.f. generate_file_()) */
@@ -806,7 +806,7 @@ static bool test_level_1_()
        FLAC::Metadata::Padding *padding;
        FLAC::Metadata::Application *app;
        FLAC__byte data[1000];
-       unsigned our_current_position = 0;
+       uint32_t our_current_position = 0;
 
        // initialize 'data' to avoid Valgrind errors
        memset(data, 0, sizeof(data));
@@ -834,7 +834,7 @@ static bool test_level_1_()
        if(!iterator.init(flacfilename(/*is_ogg=*/false), /*read_only=*/false, /*preserve_file_stats=*/false))
                return die_("iterator.init() returned false");
 
-       printf("is writable = %u\n", (unsigned)iterator.is_writable());
+       printf("is writable = %u\n", (uint32_t)iterator.is_writable());
        if(iterator.is_writable())
                return die_("iterator claims file is writable when tester thinks it should not be; are you running as root?\n");
 
@@ -917,7 +917,7 @@ static bool test_level_1_()
 
        if(0 == (app = new FLAC::Metadata::Application()))
                return die_("new FLAC::Metadata::Application()");
-       app->set_id((const unsigned char *)"duh");
+       app->set_id((const uint8_t *)"duh");
 
        printf("creating PADDING block\n");
 
@@ -942,7 +942,7 @@ static bool test_level_1_()
        }
        our_current_position = 0;
 
-       printf("is writable = %u\n", (unsigned)iterator.is_writable());
+       printf("is writable = %u\n", (uint32_t)iterator.is_writable());
 
        printf("[S]VP\ttry to write over STREAMINFO block...\n");
        if(!iterator.set_block(app, false))
@@ -1103,7 +1103,7 @@ static bool test_level_1_()
        our_current_position++;
 
        printf("S[V]P\tinsert APPLICATION after, expand into padding of exceeding size\n");
-       app->set_id((const unsigned char *)"euh"); /* twiddle the id so that our comparison doesn't miss transposition */
+       app->set_id((const uint8_t *)"euh"); /* twiddle the id so that our comparison doesn't miss transposition */
        if(!iterator.insert_block_after(app, true))
                return die_ss_("iterator.insert_block_after(app, true)", iterator);
        if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true))
@@ -1119,7 +1119,7 @@ static bool test_level_1_()
        our_current_position++;
 
        printf("SVA[P]\tset APPLICATION, expand into padding of exceeding size\n");
-       app->set_id((const unsigned char *)"fuh"); /* twiddle the id */
+       app->set_id((const uint8_t *)"fuh"); /* twiddle the id */
        if(!iterator.set_block(app, true))
                return die_ss_("iterator.set_block(app, true)", iterator);
        if(!insert_to_our_metadata_(app, our_current_position, /*copy=*/true))
@@ -1130,7 +1130,7 @@ static bool test_level_1_()
                return false;
 
        printf("SVA[A]P\tset APPLICATION (grow), don't expand into padding\n");
-       app->set_id((const unsigned char *)"guh"); /* twiddle the id */
+       app->set_id((const uint8_t *)"guh"); /* twiddle the id */
        if(!app->set_data(data, sizeof(data), true))
                return die_("setting APPLICATION data");
        if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true))
@@ -1142,7 +1142,7 @@ static bool test_level_1_()
                return false;
 
        printf("SVA[A]P\tset APPLICATION (shrink), don't fill in with padding\n");
-       app->set_id((const unsigned char *)"huh"); /* twiddle the id */
+       app->set_id((const uint8_t *)"huh"); /* twiddle the id */
        if(!app->set_data(data, 12, true))
                return die_("setting APPLICATION data");
        if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true))
@@ -1154,7 +1154,7 @@ static bool test_level_1_()
                return false;
 
        printf("SVA[A]P\tset APPLICATION (grow), expand into padding of exceeding size\n");
-       app->set_id((const unsigned char *)"iuh"); /* twiddle the id */
+       app->set_id((const uint8_t *)"iuh"); /* twiddle the id */
        if(!app->set_data(data, sizeof(data), true))
                return die_("setting APPLICATION data");
        if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true))
@@ -1167,7 +1167,7 @@ static bool test_level_1_()
                return false;
 
        printf("SVA[A]P\tset APPLICATION (shrink), fill in with padding\n");
-       app->set_id((const unsigned char *)"juh"); /* twiddle the id */
+       app->set_id((const uint8_t *)"juh"); /* twiddle the id */
        if(!app->set_data(data, 23, true))
                return die_("setting APPLICATION data");
        if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true))
@@ -1202,7 +1202,7 @@ static bool test_level_1_()
                return false;
 
        printf("SVAAP[P]\tset APPLICATION (grow)\n");
-       app->set_id((const unsigned char *)"kuh"); /* twiddle the id */
+       app->set_id((const uint8_t *)"kuh"); /* twiddle the id */
        if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true))
                return die_("copying object");
        if(!iterator.set_block(app, false))
@@ -1490,7 +1490,7 @@ static bool test_level_2_(bool filename_based, bool is_ogg)
        FLAC::Metadata::Application *app;
        FLAC::Metadata::Padding *padding;
        FLAC__byte data[2000];
-       unsigned our_current_position;
+       uint32_t our_current_position;
 
        // initialize 'data' to avoid Valgrind errors
        memset(data, 0, sizeof(data));
@@ -1578,7 +1578,7 @@ static bool test_level_2_(bool filename_based, bool is_ogg)
                return die_("getting block from iterator");
        if(0 == (app = new FLAC::Metadata::Application()))
                return die_("new FLAC::Metadata::Application()");
-       app->set_id((const unsigned char *)"duh");
+       app->set_id((const uint8_t *)"duh");
        if(!app->set_data(data, block->get_length()-(FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), true))
                return die_("setting APPLICATION data");
        delete block;
index e5ffd2a..d46c1c2 100644 (file)
@@ -40,7 +40,7 @@ static void *malloc_or_die_(size_t size)
 {
        void *x = malloc(size);
        if(0 == x) {
-               fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (unsigned)size);
+               fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size);
                exit(1);
        }
        return x;
@@ -67,7 +67,7 @@ static bool index_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Index &indx, c
 
 static bool track_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Track *track, const ::FLAC__StreamMetadata_CueSheet_Track *trackcopy)
 {
-       unsigned i;
+       uint32_t i;
 
        if(trackcopy->offset != track->offset)
                return false;
@@ -249,7 +249,7 @@ static void free_metadata_blocks_()
 
 bool test_metadata_object_streaminfo()
 {
-       unsigned expected_length;
+       uint32_t expected_length;
 
        printf("testing class FLAC::Metadata::StreamInfo\n");
 
@@ -482,7 +482,7 @@ bool test_metadata_object_streaminfo()
 
 bool test_metadata_object_padding()
 {
-       unsigned expected_length;
+       uint32_t expected_length;
 
        printf("testing class FLAC::Metadata::Padding\n");
 
@@ -643,7 +643,7 @@ bool test_metadata_object_padding()
 
 bool test_metadata_object_application()
 {
-       unsigned expected_length;
+       uint32_t expected_length;
 
        printf("testing class FLAC::Metadata::Application\n");
 
@@ -813,7 +813,7 @@ bool test_metadata_object_application()
 
 bool test_metadata_object_seektable()
 {
-       unsigned expected_length;
+       uint32_t expected_length;
 
        printf("testing class FLAC::Metadata::SeekTable\n");
 
@@ -1012,7 +1012,7 @@ bool test_metadata_object_seektable()
 
 bool test_metadata_object_vorbiscomment()
 {
-       unsigned expected_length;
+       uint32_t expected_length;
 
        printf("testing class FLAC::Metadata::VorbisComment::Entry\n");
 
@@ -1027,7 +1027,7 @@ bool test_metadata_object_vorbiscomment()
        }
        printf("OK\n");
 
-       printf("testing Entry::Entry(const char *field, unsigned field_length)... ");
+       printf("testing Entry::Entry(const char *field, uint32_t field_length)... ");
        FLAC::Metadata::VorbisComment::Entry entry2("name2=value2", strlen("name2=value2"));
        if(!entry2.is_valid())
                return die_("!is_valid()");
@@ -1043,7 +1043,7 @@ bool test_metadata_object_vorbiscomment()
                printf("OK\n");
        }
 
-       printf("testing Entry::Entry(const char *field_name, const char *field_value, unsigned field_value_length)... ");
+       printf("testing Entry::Entry(const char *field_name, const char *field_value, uint32_t field_value_length)... ");
        FLAC::Metadata::VorbisComment::Entry entry3("name3", "value3", strlen("value3"));
        if(!entry3.is_valid())
                return die_("!is_valid()");
@@ -1125,7 +1125,7 @@ bool test_metadata_object_vorbiscomment()
                return die_("entry mismatch");
        printf("OK\n");
 
-       printf("testing Entry::set_field_value(const char *field_value, unsigned field_value_length)... ");
+       printf("testing Entry::set_field_value(const char *field_value, uint32_t field_value_length)... ");
        if(!entry1.set_field_value("value1", strlen("value1")))
                return die_("returned false");
        if(0 != memcmp(entry1.get_field_value(), "value1", strlen("value1")))
@@ -1143,7 +1143,7 @@ bool test_metadata_object_vorbiscomment()
                return die_("entry mismatch");
        printf("OK\n");
 
-       printf("testing Entry::set_field(const char *field, unsigned field_length)... ");
+       printf("testing Entry::set_field(const char *field, uint32_t field_length)... ");
        if(!entry1.set_field("name0=value0", strlen("name0=value0")))
                return die_("returned false");
        if(0 != memcmp(entry1.get_field_name(), "name0", strlen("name0")))
@@ -1428,7 +1428,7 @@ bool test_metadata_object_vorbiscomment()
 
 bool test_metadata_object_cuesheet()
 {
-       unsigned expected_length;
+       uint32_t expected_length;
 
        printf("testing class FLAC::Metadata::CueSheet::Track\n");
 
@@ -1807,7 +1807,7 @@ bool test_metadata_object_cuesheet()
 
 bool test_metadata_object_picture()
 {
-       unsigned expected_length;
+       uint32_t expected_length;
 
        printf("testing class FLAC::Metadata::Picture\n");
 
index a01945f..62f00e4 100644 (file)
@@ -37,18 +37,18 @@ static inline uint64_t time2nsec(const FILETIME &t)
 
 static void printtime(FILE *fout, uint64_t nsec, uint64_t total)
 {
-       unsigned pct = (unsigned)(100.0 * ((double)nsec / (double)total));
+       uint32_t pct = (uint32_t)(100.0 * ((double)nsec / (double)total));
        uint64_t msec = nsec / 1000000; nsec -= msec * 1000000;
        uint64_t sec = msec / 1000; msec -= sec * 1000;
        uint64_t min = sec / 60; sec -= min * 60;
        uint64_t hour = min / 60; min -= hour * 60;
        fprintf(fout, " %5u.%03u = %02u:%02u:%02u.%03u = %3u%%\n",
-               (unsigned)((hour*60+min)*60+sec),
-               (unsigned)msec,
-               (unsigned)hour,
-               (unsigned)min,
-               (unsigned)sec,
-               (unsigned)msec,
+               (uint32_t)((hour*60+min)*60+sec),
+               (uint32_t)msec,
+               (uint32_t)hour,
+               (uint32_t)min,
+               (uint32_t)sec,
+               (uint32_t)msec,
                pct
        );
 }