diff --git a/include/FLAC++/encoder.h b/include/FLAC++/encoder.h index 7ed2d52a..071ff7f8 100644 --- a/include/FLAC++/encoder.h +++ b/include/FLAC++/encoder.h @@ -80,9 +80,7 @@ namespace FLAC { bool set_max_residual_partition_order(unsigned value); bool set_rice_parameter_search_dist(unsigned value); bool set_total_samples_estimate(FLAC__uint64 value); - bool set_seek_table(const FLAC__StreamMetaData_SeekTable *value); - bool set_padding(int value); - bool set_last_metadata_is_last(bool value); + bool set_metadata(FLAC__StreamMetaData **metadata, unsigned num_blocks); State get_state() const; bool get_streamable_subset() const; diff --git a/src/libFLAC++/Makefile.vc b/src/libFLAC++/Makefile.vc index 9a35a1be..b2693003 100644 --- a/src/libFLAC++/Makefile.vc +++ b/src/libFLAC++/Makefile.vc @@ -18,12 +18,14 @@ !include +SUFFIXES = .cpp + !IFDEF DEBUG .cc.obj: - $(ccc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $< + $(cc) /D "_LIB" /GX $(cdebug) $(cflags) /I "..\..\include" -DSTRICT -YX /Od /D "_DEBUG" $< !else .cc.obj: - $(ccc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $< + $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG $< !endif CC_FILES= \ @@ -40,6 +42,18 @@ all: libFLAC++.lib libFLAC++.lib: $(OBJS) link.exe -lib /nodefaultlib -out:../../obj/lib/$*.lib $(OBJS) +# can't figure out how to get it to take .cc so we just hack it for now: +file_decoder.obj: file_decoder.cc + $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP file_decoder.cc +metadata.obj: metadata.cc + $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP metadata.cc +seekable_stream_decoder.obj: seekable_stream_decoder.cc + $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP seekable_stream_decoder.cc +stream_decoder.obj: stream_decoder.cc + $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP stream_decoder.cc +stream_encoder.obj: stream_encoder.cc + $(cc) /D "_LIB" /O2 $(crelease) $(cflags) /I "..\..\include" -DSTRICT -YX -DNODEBUG /TP stream_encoder.cc + clean: - -del *.obj ia32\*.obj *.pch + -del *.obj *.pch -del ..\..\obj\lib\libFLAC++.lib ..\..\obj\lib\libFLAC++.pdb diff --git a/src/libFLAC++/file_decoder.cc b/src/libFLAC++/file_decoder.cc index 5c22e1b0..21fa8021 100644 --- a/src/libFLAC++/file_decoder.cc +++ b/src/libFLAC++/file_decoder.cc @@ -43,49 +43,49 @@ namespace FLAC { bool File::set_md5_checking(bool value) { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_md5_checking(decoder_, value); + return (bool)::FLAC__file_decoder_set_md5_checking(decoder_, value); } bool File::set_filename(const char *value) { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_filename(decoder_, value); + return (bool)::FLAC__file_decoder_set_filename(decoder_, value); } bool File::set_metadata_respond(::FLAC__MetaDataType type) { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_metadata_respond(decoder_, type); + return (bool)::FLAC__file_decoder_set_metadata_respond(decoder_, type); } bool File::set_metadata_respond_application(const FLAC__byte id[4]) { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_metadata_respond_application(decoder_, id); + return (bool)::FLAC__file_decoder_set_metadata_respond_application(decoder_, id); } bool File::set_metadata_respond_all() { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_metadata_respond_all(decoder_); + return (bool)::FLAC__file_decoder_set_metadata_respond_all(decoder_); } bool File::set_metadata_ignore(::FLAC__MetaDataType type) { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_metadata_ignore(decoder_, type); + return (bool)::FLAC__file_decoder_set_metadata_ignore(decoder_, type); } bool File::set_metadata_ignore_application(const FLAC__byte id[4]) { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_metadata_ignore_application(decoder_, id); + return (bool)::FLAC__file_decoder_set_metadata_ignore_application(decoder_, id); } bool File::set_metadata_ignore_all() { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_set_metadata_ignore_all(decoder_); + return (bool)::FLAC__file_decoder_set_metadata_ignore_all(decoder_); } File::State File::get_state() const @@ -97,7 +97,7 @@ namespace FLAC { bool File::get_md5_checking() const { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_get_md5_checking(decoder_); + return (bool)::FLAC__file_decoder_get_md5_checking(decoder_); } File::State File::init() @@ -113,37 +113,37 @@ namespace FLAC { bool File::finish() { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_finish(decoder_); + return (bool)::FLAC__file_decoder_finish(decoder_); } bool File::process_whole_file() { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_process_whole_file(decoder_); + return (bool)::FLAC__file_decoder_process_whole_file(decoder_); } bool File::process_metadata() { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_process_metadata(decoder_); + return (bool)::FLAC__file_decoder_process_metadata(decoder_); } bool File::process_one_frame() { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_process_one_frame(decoder_); + return (bool)::FLAC__file_decoder_process_one_frame(decoder_); } bool File::process_remaining_frames() { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_process_remaining_frames(decoder_); + return (bool)::FLAC__file_decoder_process_remaining_frames(decoder_); } bool File::seek_absolute(FLAC__uint64 sample) { FLAC__ASSERT(0 != decoder_); - return ::FLAC__file_decoder_seek_absolute(decoder_, sample); + return (bool)::FLAC__file_decoder_seek_absolute(decoder_, sample); } ::FLAC__StreamDecoderWriteStatus File::write_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data) diff --git a/src/libFLAC++/metadata.cc b/src/libFLAC++/metadata.cc index 50bc4015..b36eb6af 100644 --- a/src/libFLAC++/metadata.cc +++ b/src/libFLAC++/metadata.cc @@ -109,7 +109,7 @@ namespace FLAC { bool Prototype::get_is_last() const { FLAC__ASSERT(is_valid()); - return object_->is_last; + return (bool)object_->is_last; } FLAC__MetaDataType Prototype::get_type() const @@ -321,7 +321,7 @@ namespace FLAC { bool Application::set_data(FLAC__byte *data, unsigned length, bool copy) { FLAC__ASSERT(is_valid()); - return FLAC__metadata_object_application_set_data(object_, data, length, copy); + return (bool)::FLAC__metadata_object_application_set_data(object_, data, length, copy); } @@ -364,14 +364,14 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index <= object_->data.seek_table.num_points); - return ::FLAC__metadata_object_seektable_insert_point(object_, index, point); + return (bool)::FLAC__metadata_object_seektable_insert_point(object_, index, point); } bool SeekTable::delete_point(unsigned index) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index < object_->data.seek_table.num_points); - return ::FLAC__metadata_object_seektable_delete_point(object_, index); + return (bool)::FLAC__metadata_object_seektable_delete_point(object_, index); } @@ -678,28 +678,28 @@ namespace FLAC { bool VorbisComment::set_vendor_string(const VorbisComment::Entry &entry) { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, entry.get_entry(), /*copy=*/true); + return (bool)::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, entry.get_entry(), /*copy=*/true); } bool VorbisComment::set_comment(unsigned index, const VorbisComment::Entry &entry) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); - return ::FLAC__metadata_object_vorbiscomment_set_comment(object_, index, entry.get_entry(), /*copy=*/true); + return (bool)::FLAC__metadata_object_vorbiscomment_set_comment(object_, index, entry.get_entry(), /*copy=*/true); } bool VorbisComment::insert_comment(unsigned index, const VorbisComment::Entry &entry) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index <= object_->data.vorbis_comment.num_comments); - return ::FLAC__metadata_object_vorbiscomment_insert_comment(object_, index, entry.get_entry(), /*copy=*/true); + return (bool)::FLAC__metadata_object_vorbiscomment_insert_comment(object_, index, entry.get_entry(), /*copy=*/true); } bool VorbisComment::delete_comment(unsigned index) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); - return ::FLAC__metadata_object_vorbiscomment_delete_comment(object_, index); + return (bool)::FLAC__metadata_object_vorbiscomment_delete_comment(object_, index); } @@ -750,7 +750,7 @@ namespace FLAC { { FLAC__ASSERT(0 != filename); FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_init(iterator_, filename, preserve_file_stats); + return (bool)::FLAC__metadata_simple_iterator_init(iterator_, filename, preserve_file_stats); } bool SimpleIterator::is_valid() const @@ -767,19 +767,19 @@ namespace FLAC { bool SimpleIterator::is_writable() const { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_is_writable(iterator_); + return (bool)::FLAC__metadata_simple_iterator_is_writable(iterator_); } bool SimpleIterator::next() { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_next(iterator_); + return (bool)::FLAC__metadata_simple_iterator_next(iterator_); } bool SimpleIterator::prev() { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_prev(iterator_); + return (bool)::FLAC__metadata_simple_iterator_prev(iterator_); } ::FLAC__MetaDataType SimpleIterator::get_block_type() const @@ -798,20 +798,20 @@ namespace FLAC { { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_set_block(iterator_, block->object_, use_padding); + return (bool)::FLAC__metadata_simple_iterator_set_block(iterator_, block->object_, use_padding); } bool SimpleIterator::insert_block_after(Prototype *block, bool use_padding) { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_insert_block_after(iterator_, block->object_, use_padding); + return (bool)::FLAC__metadata_simple_iterator_insert_block_after(iterator_, block->object_, use_padding); } bool SimpleIterator::delete_block(bool use_padding) { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_delete_block(iterator_, use_padding); + return (bool)::FLAC__metadata_simple_iterator_delete_block(iterator_, use_padding); } @@ -852,13 +852,13 @@ namespace FLAC { { FLAC__ASSERT(0 != filename); FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_chain_read(chain_, filename); + return (bool)::FLAC__metadata_chain_read(chain_, filename); } bool Chain::write(bool use_padding, bool preserve_file_stats) { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_chain_write(chain_, use_padding, preserve_file_stats); + return (bool)::FLAC__metadata_chain_write(chain_, use_padding, preserve_file_stats); } void Chain::merge_padding() @@ -906,13 +906,13 @@ namespace FLAC { bool Iterator::next() { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_iterator_next(iterator_); + return (bool)::FLAC__metadata_iterator_next(iterator_); } bool Iterator::prev() { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_iterator_prev(iterator_); + return (bool)::FLAC__metadata_iterator_prev(iterator_); } ::FLAC__MetaDataType Iterator::get_block_type() const @@ -934,7 +934,7 @@ namespace FLAC { { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - bool ret = ::FLAC__metadata_iterator_set_block(iterator_, block->object_); + bool ret = (bool)::FLAC__metadata_iterator_set_block(iterator_, block->object_); if(ret) { block->set_reference(true); delete block; @@ -945,14 +945,14 @@ namespace FLAC { bool Iterator::delete_block(bool replace_with_padding) { FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_iterator_delete_block(iterator_, replace_with_padding); + return (bool)::FLAC__metadata_iterator_delete_block(iterator_, replace_with_padding); } bool Iterator::insert_block_before(Prototype *block) { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - bool ret = ::FLAC__metadata_iterator_insert_block_before(iterator_, block->object_); + bool ret = (bool)::FLAC__metadata_iterator_insert_block_before(iterator_, block->object_); if(ret) { block->set_reference(true); delete block; @@ -964,7 +964,7 @@ namespace FLAC { { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - bool ret = ::FLAC__metadata_iterator_insert_block_after(iterator_, block->object_); + bool ret = (bool)::FLAC__metadata_iterator_insert_block_after(iterator_, block->object_); if(ret) { block->set_reference(true); delete block; diff --git a/src/libFLAC++/seekable_stream_decoder.cc b/src/libFLAC++/seekable_stream_decoder.cc index 2c75f253..81744b37 100644 --- a/src/libFLAC++/seekable_stream_decoder.cc +++ b/src/libFLAC++/seekable_stream_decoder.cc @@ -43,43 +43,43 @@ namespace FLAC { bool SeekableStream::set_md5_checking(bool value) { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_set_md5_checking(decoder_, value); + return (bool)::FLAC__seekable_stream_decoder_set_md5_checking(decoder_, value); } bool SeekableStream::set_metadata_respond(::FLAC__MetaDataType type) { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_set_metadata_respond(decoder_, type); + return (bool)::FLAC__seekable_stream_decoder_set_metadata_respond(decoder_, type); } bool SeekableStream::set_metadata_respond_application(const FLAC__byte id[4]) { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_set_metadata_respond_application(decoder_, id); + return (bool)::FLAC__seekable_stream_decoder_set_metadata_respond_application(decoder_, id); } bool SeekableStream::set_metadata_respond_all() { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_set_metadata_respond_all(decoder_); + return (bool)::FLAC__seekable_stream_decoder_set_metadata_respond_all(decoder_); } bool SeekableStream::set_metadata_ignore(::FLAC__MetaDataType type) { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_set_metadata_ignore(decoder_, type); + return (bool)::FLAC__seekable_stream_decoder_set_metadata_ignore(decoder_, type); } bool SeekableStream::set_metadata_ignore_application(const FLAC__byte id[4]) { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_set_metadata_ignore_application(decoder_, id); + return (bool)::FLAC__seekable_stream_decoder_set_metadata_ignore_application(decoder_, id); } bool SeekableStream::set_metadata_ignore_all() { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_set_metadata_ignore_all(decoder_); + return (bool)::FLAC__seekable_stream_decoder_set_metadata_ignore_all(decoder_); } SeekableStream::State SeekableStream::get_state() const @@ -91,7 +91,7 @@ namespace FLAC { bool SeekableStream::get_md5_checking() const { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_get_md5_checking(decoder_); + return (bool)::FLAC__seekable_stream_decoder_get_md5_checking(decoder_); } SeekableStream::State SeekableStream::init() @@ -112,37 +112,37 @@ namespace FLAC { bool SeekableStream::finish() { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_finish(decoder_); + return (bool)::FLAC__seekable_stream_decoder_finish(decoder_); } bool SeekableStream::process_whole_stream() { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_process_whole_stream(decoder_); + return (bool)::FLAC__seekable_stream_decoder_process_whole_stream(decoder_); } bool SeekableStream::process_metadata() { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_process_metadata(decoder_); + return (bool)::FLAC__seekable_stream_decoder_process_metadata(decoder_); } bool SeekableStream::process_one_frame() { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_process_one_frame(decoder_); + return (bool)::FLAC__seekable_stream_decoder_process_one_frame(decoder_); } bool SeekableStream::process_remaining_frames() { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_process_remaining_frames(decoder_); + return (bool)::FLAC__seekable_stream_decoder_process_remaining_frames(decoder_); } bool SeekableStream::seek_absolute(FLAC__uint64 sample) { FLAC__ASSERT(is_valid()); - return ::FLAC__seekable_stream_decoder_seek_absolute(decoder_, sample); + return (bool)::FLAC__seekable_stream_decoder_seek_absolute(decoder_, sample); } FLAC__SeekableStreamDecoderReadStatus SeekableStream::read_callback_(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) diff --git a/src/libFLAC++/stream_decoder.cc b/src/libFLAC++/stream_decoder.cc index ce420171..efa12069 100644 --- a/src/libFLAC++/stream_decoder.cc +++ b/src/libFLAC++/stream_decoder.cc @@ -43,37 +43,37 @@ namespace FLAC { bool Stream::set_metadata_respond(::FLAC__MetaDataType type) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_set_metadata_respond(decoder_, type); + return (bool)::FLAC__stream_decoder_set_metadata_respond(decoder_, type); } bool Stream::set_metadata_respond_application(const FLAC__byte id[4]) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_set_metadata_respond_application(decoder_, id); + return (bool)::FLAC__stream_decoder_set_metadata_respond_application(decoder_, id); } bool Stream::set_metadata_respond_all() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_set_metadata_respond_all(decoder_); + return (bool)::FLAC__stream_decoder_set_metadata_respond_all(decoder_); } bool Stream::set_metadata_ignore(::FLAC__MetaDataType type) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_set_metadata_ignore(decoder_, type); + return (bool)::FLAC__stream_decoder_set_metadata_ignore(decoder_, type); } bool Stream::set_metadata_ignore_application(const FLAC__byte id[4]) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_set_metadata_ignore_application(decoder_, id); + return (bool)::FLAC__stream_decoder_set_metadata_ignore_application(decoder_, id); } bool Stream::set_metadata_ignore_all() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_set_metadata_ignore_all(decoder_); + return (bool)::FLAC__stream_decoder_set_metadata_ignore_all(decoder_); } Stream::State Stream::get_state() const @@ -132,37 +132,37 @@ namespace FLAC { bool Stream::flush() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_flush(decoder_); + return (bool)::FLAC__stream_decoder_flush(decoder_); } bool Stream::reset() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_reset(decoder_); + return (bool)::FLAC__stream_decoder_reset(decoder_); } bool Stream::process_whole_stream() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_process_whole_stream(decoder_); + return (bool)::FLAC__stream_decoder_process_whole_stream(decoder_); } bool Stream::process_metadata() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_process_metadata(decoder_); + return (bool)::FLAC__stream_decoder_process_metadata(decoder_); } bool Stream::process_one_frame() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_process_one_frame(decoder_); + return (bool)::FLAC__stream_decoder_process_one_frame(decoder_); } bool Stream::process_remaining_frames() { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_process_remaining_frames(decoder_); + return (bool)::FLAC__stream_decoder_process_remaining_frames(decoder_); } ::FLAC__StreamDecoderReadStatus Stream::read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) diff --git a/src/libFLAC++/stream_encoder.cc b/src/libFLAC++/stream_encoder.cc index 0f6aa854..5b87d2fe 100644 --- a/src/libFLAC++/stream_encoder.cc +++ b/src/libFLAC++/stream_encoder.cc @@ -43,115 +43,103 @@ namespace FLAC { bool Stream::set_streamable_subset(bool value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_streamable_subset(encoder_, value); + return (bool)::FLAC__stream_encoder_set_streamable_subset(encoder_, value); } bool Stream::set_do_mid_side_stereo(bool value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value); + return (bool)::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value); } bool Stream::set_loose_mid_side_stereo(bool value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value); + return (bool)::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value); } bool Stream::set_channels(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_channels(encoder_, value); + return (bool)::FLAC__stream_encoder_set_channels(encoder_, value); } bool Stream::set_bits_per_sample(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_bits_per_sample(encoder_, value); + return (bool)::FLAC__stream_encoder_set_bits_per_sample(encoder_, value); } bool Stream::set_sample_rate(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_sample_rate(encoder_, value); + return (bool)::FLAC__stream_encoder_set_sample_rate(encoder_, value); } bool Stream::set_blocksize(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_blocksize(encoder_, value); + return (bool)::FLAC__stream_encoder_set_blocksize(encoder_, value); } bool Stream::set_max_lpc_order(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_max_lpc_order(encoder_, value); + return (bool)::FLAC__stream_encoder_set_max_lpc_order(encoder_, value); } bool Stream::set_qlp_coeff_precision(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value); + return (bool)::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value); } bool Stream::set_do_qlp_coeff_prec_search(bool value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value); + return (bool)::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value); } bool Stream::set_do_escape_coding(bool value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_do_escape_coding(encoder_, value); + return (bool)::FLAC__stream_encoder_set_do_escape_coding(encoder_, value); } bool Stream::set_do_exhaustive_model_search(bool value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value); + return (bool)::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value); } bool Stream::set_min_residual_partition_order(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value); + return (bool)::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value); } bool Stream::set_max_residual_partition_order(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value); + return (bool)::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value); } bool Stream::set_rice_parameter_search_dist(unsigned value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value); + return (bool)::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value); } bool Stream::set_total_samples_estimate(FLAC__uint64 value) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value); + return (bool)::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value); } - bool Stream::set_seek_table(const FLAC__StreamMetaData_SeekTable *value) + bool Stream::set_metadata(FLAC__StreamMetaData **metadata, unsigned num_blocks) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_seek_table(encoder_, value); - } - - bool Stream::set_padding(int value) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_padding(encoder_, value); - } - - bool Stream::set_last_metadata_is_last(bool value) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_set_last_metadata_is_last(encoder_, value); + return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks); } Stream::State Stream::get_state() const @@ -163,19 +151,19 @@ namespace FLAC { bool Stream::get_streamable_subset() const { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_streamable_subset(encoder_); + return (bool)::FLAC__stream_encoder_get_streamable_subset(encoder_); } bool Stream::get_do_mid_side_stereo() const { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_); + return (bool)::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_); } bool Stream::get_loose_mid_side_stereo() const { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_); + return (bool)::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_); } unsigned Stream::get_channels() const @@ -217,19 +205,19 @@ namespace FLAC { bool Stream::get_do_qlp_coeff_prec_search() const { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_); + return (bool)::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_); } bool Stream::get_do_escape_coding() const { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_do_escape_coding(encoder_); + return (bool)::FLAC__stream_encoder_get_do_escape_coding(encoder_); } bool Stream::get_do_exhaustive_model_search() const { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_); + return (bool)::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_); } unsigned Stream::get_min_residual_partition_order() const @@ -268,13 +256,13 @@ namespace FLAC { bool Stream::process(const FLAC__int32 *buf[], unsigned samples) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_process(encoder_, buf, samples); + return (bool)::FLAC__stream_encoder_process(encoder_, buf, samples); } bool Stream::process_interleaved(const FLAC__int32 buf[], unsigned samples) { FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_process_interleaved(encoder_, buf, samples); + return (bool)::FLAC__stream_encoder_process_interleaved(encoder_, buf, samples); } ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c index deeccc1e..8fc4e51e 100644 --- a/src/libFLAC/metadata_iterators.c +++ b/src/libFLAC/metadata_iterators.c @@ -1426,8 +1426,9 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_seektable_(FILE *fi FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_(FILE *file, FLAC__StreamMetaData_VorbisComment_Entry *entry) { const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; - FLAC__byte buffer[FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8]; + FLAC__byte buffer[4]; /* magic number is asserted below */ + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8 == 4); FLAC__ASSERT(0 != file); if(fread(buffer, 1, entry_length_len, file) != entry_length_len) @@ -1453,8 +1454,9 @@ FLAC__MetaData_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_(FIL unsigned i; FLAC__MetaData_SimpleIteratorStatus status; const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; - FLAC__byte buffer[FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8]; + FLAC__byte buffer[4]; /* magic number is asserted below */ + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8 == 4); FLAC__ASSERT(0 != file); if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_(file, &(block->vendor_string)))) @@ -1544,7 +1546,7 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_streaminfo_(FILE * buffer[10] = (block->sample_rate >> 12) & 0xff; buffer[11] = (block->sample_rate >> 4) & 0xff; buffer[12] = ((block->sample_rate & 0x0f) << 4) | (channels1 << 1) | (bps1 >> 4); - buffer[13] = ((bps1 & 0x0f) << 4) | ((block->total_samples >> 32) & 0x0f); + buffer[13] = (FLAC__byte)(((bps1 & 0x0f) << 4) | ((block->total_samples >> 32) & 0x0f)); pack_uint32_((FLAC__uint32)block->total_samples, buffer+14, 4); memcpy(buffer+18, block->md5sum, 16); @@ -1618,8 +1620,9 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_vorbis_comment_(FI unsigned i; const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; - FLAC__byte buffer[max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8]; + FLAC__byte buffer[4]; /* magic number is asserted below */ + FLAC__ASSERT(max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == 4); FLAC__ASSERT(0 != file); pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len); diff --git a/src/metaflac/Makefile.vc b/src/metaflac/Makefile.vc index 5157a029..f7256713 100644 --- a/src/metaflac/Makefile.vc +++ b/src/metaflac/Makefile.vc @@ -33,7 +33,7 @@ OBJS= $(C_FILES:.c=.obj) all: metaflac.exe metaflac.exe: $(OBJS) - link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) + link.exe /libpath:"..\..\obj\lib" -out:../../obj/bin/$*.exe $(OBJS) libFLAC.lib getopt.lib clean: -del *.obj *.pch diff --git a/src/metaflac/main.c b/src/metaflac/main.c index 915228dc..e0b4f507 100644 --- a/src/metaflac/main.c +++ b/src/metaflac/main.c @@ -201,7 +201,7 @@ typedef struct { unsigned capacity; } args; unsigned num_files; - const char **filenames; + char **filenames; } CommandLineOptions; static void die(const char *message); diff --git a/src/test_unit/file_utils.c b/src/test_unit/file_utils.c index 5ab82b6f..2a80293f 100644 --- a/src/test_unit/file_utils.c +++ b/src/test_unit/file_utils.c @@ -61,6 +61,7 @@ FLAC__bool file_utils__change_stats(const char *filename, FLAC__bool read_only) struct stat stats; if(0 == stat(filename, &stats)) { +#if !defined _MSC_VER && !defined __MINGW32__ if(read_only) { stats.st_mode &= ~S_IWUSR; stats.st_mode &= ~S_IWGRP; @@ -71,6 +72,12 @@ FLAC__bool file_utils__change_stats(const char *filename, FLAC__bool read_only) stats.st_mode |= S_IWGRP; stats.st_mode |= S_IWOTH; } +#else + if(read_only) + stats.st_mode &= ~S_IWRITE; + else + stats.st_mode |= S_IWRITE; +#endif if(0 != chmod(filename, stats.st_mode)) return false; }