fixes based on MSVC compile

This commit is contained in:
Josh Coalson
2002-06-01 06:31:27 +00:00
parent ba2c1b89fb
commit 7ee4d1780c
11 changed files with 124 additions and 114 deletions

View File

@@ -80,9 +80,7 @@ namespace FLAC {
bool set_max_residual_partition_order(unsigned value); bool set_max_residual_partition_order(unsigned value);
bool set_rice_parameter_search_dist(unsigned value); bool set_rice_parameter_search_dist(unsigned value);
bool set_total_samples_estimate(FLAC__uint64 value); bool set_total_samples_estimate(FLAC__uint64 value);
bool set_seek_table(const FLAC__StreamMetaData_SeekTable *value); bool set_metadata(FLAC__StreamMetaData **metadata, unsigned num_blocks);
bool set_padding(int value);
bool set_last_metadata_is_last(bool value);
State get_state() const; State get_state() const;
bool get_streamable_subset() const; bool get_streamable_subset() const;

View File

@@ -18,12 +18,14 @@
!include <win32.mak> !include <win32.mak>
SUFFIXES = .cpp
!IFDEF DEBUG !IFDEF DEBUG
.cc.obj: .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 !else
.cc.obj: .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 !endif
CC_FILES= \ CC_FILES= \
@@ -40,6 +42,18 @@ all: libFLAC++.lib
libFLAC++.lib: $(OBJS) libFLAC++.lib: $(OBJS)
link.exe -lib /nodefaultlib -out:../../obj/lib/$*.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: clean:
-del *.obj ia32\*.obj *.pch -del *.obj *.pch
-del ..\..\obj\lib\libFLAC++.lib ..\..\obj\lib\libFLAC++.pdb -del ..\..\obj\lib\libFLAC++.lib ..\..\obj\lib\libFLAC++.pdb

View File

@@ -43,49 +43,49 @@ namespace FLAC {
bool File::set_md5_checking(bool value) bool File::set_md5_checking(bool value)
{ {
FLAC__ASSERT(0 != decoder_); 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) bool File::set_filename(const char *value)
{ {
FLAC__ASSERT(0 != decoder_); 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) bool File::set_metadata_respond(::FLAC__MetaDataType type)
{ {
FLAC__ASSERT(0 != decoder_); 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]) bool File::set_metadata_respond_application(const FLAC__byte id[4])
{ {
FLAC__ASSERT(0 != decoder_); 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() bool File::set_metadata_respond_all()
{ {
FLAC__ASSERT(0 != decoder_); 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) bool File::set_metadata_ignore(::FLAC__MetaDataType type)
{ {
FLAC__ASSERT(0 != decoder_); 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]) bool File::set_metadata_ignore_application(const FLAC__byte id[4])
{ {
FLAC__ASSERT(0 != decoder_); 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() bool File::set_metadata_ignore_all()
{ {
FLAC__ASSERT(0 != decoder_); 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 File::State File::get_state() const
@@ -97,7 +97,7 @@ namespace FLAC {
bool File::get_md5_checking() const bool File::get_md5_checking() const
{ {
FLAC__ASSERT(0 != decoder_); 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() File::State File::init()
@@ -113,37 +113,37 @@ namespace FLAC {
bool File::finish() bool File::finish()
{ {
FLAC__ASSERT(0 != decoder_); FLAC__ASSERT(0 != decoder_);
return ::FLAC__file_decoder_finish(decoder_); return (bool)::FLAC__file_decoder_finish(decoder_);
} }
bool File::process_whole_file() bool File::process_whole_file()
{ {
FLAC__ASSERT(0 != decoder_); 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() bool File::process_metadata()
{ {
FLAC__ASSERT(0 != decoder_); FLAC__ASSERT(0 != decoder_);
return ::FLAC__file_decoder_process_metadata(decoder_); return (bool)::FLAC__file_decoder_process_metadata(decoder_);
} }
bool File::process_one_frame() bool File::process_one_frame()
{ {
FLAC__ASSERT(0 != decoder_); 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() bool File::process_remaining_frames()
{ {
FLAC__ASSERT(0 != decoder_); 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) bool File::seek_absolute(FLAC__uint64 sample)
{ {
FLAC__ASSERT(0 != decoder_); 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) ::FLAC__StreamDecoderWriteStatus File::write_callback_(const ::FLAC__FileDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)

View File

@@ -109,7 +109,7 @@ namespace FLAC {
bool Prototype::get_is_last() const bool Prototype::get_is_last() const
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return object_->is_last; return (bool)object_->is_last;
} }
FLAC__MetaDataType Prototype::get_type() const FLAC__MetaDataType Prototype::get_type() const
@@ -321,7 +321,7 @@ namespace FLAC {
bool Application::set_data(FLAC__byte *data, unsigned length, bool copy) bool Application::set_data(FLAC__byte *data, unsigned length, bool copy)
{ {
FLAC__ASSERT(is_valid()); 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(is_valid());
FLAC__ASSERT(index <= object_->data.seek_table.num_points); 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) bool SeekTable::delete_point(unsigned index)
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
FLAC__ASSERT(index < object_->data.seek_table.num_points); 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) bool VorbisComment::set_vendor_string(const VorbisComment::Entry &entry)
{ {
FLAC__ASSERT(is_valid()); 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) bool VorbisComment::set_comment(unsigned index, const VorbisComment::Entry &entry)
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); 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) bool VorbisComment::insert_comment(unsigned index, const VorbisComment::Entry &entry)
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
FLAC__ASSERT(index <= object_->data.vorbis_comment.num_comments); 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) bool VorbisComment::delete_comment(unsigned index)
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); 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(0 != filename);
FLAC__ASSERT(is_valid()); 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 bool SimpleIterator::is_valid() const
@@ -767,19 +767,19 @@ namespace FLAC {
bool SimpleIterator::is_writable() const bool SimpleIterator::is_writable() const
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__metadata_simple_iterator_is_writable(iterator_); return (bool)::FLAC__metadata_simple_iterator_is_writable(iterator_);
} }
bool SimpleIterator::next() bool SimpleIterator::next()
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__metadata_simple_iterator_next(iterator_); return (bool)::FLAC__metadata_simple_iterator_next(iterator_);
} }
bool SimpleIterator::prev() bool SimpleIterator::prev()
{ {
FLAC__ASSERT(is_valid()); 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 ::FLAC__MetaDataType SimpleIterator::get_block_type() const
@@ -798,20 +798,20 @@ namespace FLAC {
{ {
FLAC__ASSERT(0 != block); FLAC__ASSERT(0 != block);
FLAC__ASSERT(is_valid()); 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) bool SimpleIterator::insert_block_after(Prototype *block, bool use_padding)
{ {
FLAC__ASSERT(0 != block); FLAC__ASSERT(0 != block);
FLAC__ASSERT(is_valid()); 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) bool SimpleIterator::delete_block(bool use_padding)
{ {
FLAC__ASSERT(is_valid()); 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(0 != filename);
FLAC__ASSERT(is_valid()); 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) bool Chain::write(bool use_padding, bool preserve_file_stats)
{ {
FLAC__ASSERT(is_valid()); 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() void Chain::merge_padding()
@@ -906,13 +906,13 @@ namespace FLAC {
bool Iterator::next() bool Iterator::next()
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__metadata_iterator_next(iterator_); return (bool)::FLAC__metadata_iterator_next(iterator_);
} }
bool Iterator::prev() bool Iterator::prev()
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__metadata_iterator_prev(iterator_); return (bool)::FLAC__metadata_iterator_prev(iterator_);
} }
::FLAC__MetaDataType Iterator::get_block_type() const ::FLAC__MetaDataType Iterator::get_block_type() const
@@ -934,7 +934,7 @@ namespace FLAC {
{ {
FLAC__ASSERT(0 != block); FLAC__ASSERT(0 != block);
FLAC__ASSERT(is_valid()); 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) { if(ret) {
block->set_reference(true); block->set_reference(true);
delete block; delete block;
@@ -945,14 +945,14 @@ namespace FLAC {
bool Iterator::delete_block(bool replace_with_padding) bool Iterator::delete_block(bool replace_with_padding)
{ {
FLAC__ASSERT(is_valid()); 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) bool Iterator::insert_block_before(Prototype *block)
{ {
FLAC__ASSERT(0 != block); FLAC__ASSERT(0 != block);
FLAC__ASSERT(is_valid()); 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) { if(ret) {
block->set_reference(true); block->set_reference(true);
delete block; delete block;
@@ -964,7 +964,7 @@ namespace FLAC {
{ {
FLAC__ASSERT(0 != block); FLAC__ASSERT(0 != block);
FLAC__ASSERT(is_valid()); 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) { if(ret) {
block->set_reference(true); block->set_reference(true);
delete block; delete block;

View File

@@ -43,43 +43,43 @@ namespace FLAC {
bool SeekableStream::set_md5_checking(bool value) bool SeekableStream::set_md5_checking(bool value)
{ {
FLAC__ASSERT(is_valid()); 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) bool SeekableStream::set_metadata_respond(::FLAC__MetaDataType type)
{ {
FLAC__ASSERT(is_valid()); 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]) bool SeekableStream::set_metadata_respond_application(const FLAC__byte id[4])
{ {
FLAC__ASSERT(is_valid()); 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() bool SeekableStream::set_metadata_respond_all()
{ {
FLAC__ASSERT(is_valid()); 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) bool SeekableStream::set_metadata_ignore(::FLAC__MetaDataType type)
{ {
FLAC__ASSERT(is_valid()); 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]) bool SeekableStream::set_metadata_ignore_application(const FLAC__byte id[4])
{ {
FLAC__ASSERT(is_valid()); 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() bool SeekableStream::set_metadata_ignore_all()
{ {
FLAC__ASSERT(is_valid()); 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 SeekableStream::State SeekableStream::get_state() const
@@ -91,7 +91,7 @@ namespace FLAC {
bool SeekableStream::get_md5_checking() const bool SeekableStream::get_md5_checking() const
{ {
FLAC__ASSERT(is_valid()); 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() SeekableStream::State SeekableStream::init()
@@ -112,37 +112,37 @@ namespace FLAC {
bool SeekableStream::finish() bool SeekableStream::finish()
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__seekable_stream_decoder_finish(decoder_); return (bool)::FLAC__seekable_stream_decoder_finish(decoder_);
} }
bool SeekableStream::process_whole_stream() bool SeekableStream::process_whole_stream()
{ {
FLAC__ASSERT(is_valid()); 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() bool SeekableStream::process_metadata()
{ {
FLAC__ASSERT(is_valid()); 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() bool SeekableStream::process_one_frame()
{ {
FLAC__ASSERT(is_valid()); 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() bool SeekableStream::process_remaining_frames()
{ {
FLAC__ASSERT(is_valid()); 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) bool SeekableStream::seek_absolute(FLAC__uint64 sample)
{ {
FLAC__ASSERT(is_valid()); 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) FLAC__SeekableStreamDecoderReadStatus SeekableStream::read_callback_(const ::FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)

View File

@@ -43,37 +43,37 @@ namespace FLAC {
bool Stream::set_metadata_respond(::FLAC__MetaDataType type) bool Stream::set_metadata_respond(::FLAC__MetaDataType type)
{ {
FLAC__ASSERT(is_valid()); 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]) bool Stream::set_metadata_respond_application(const FLAC__byte id[4])
{ {
FLAC__ASSERT(is_valid()); 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() bool Stream::set_metadata_respond_all()
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_metadata_ignore(::FLAC__MetaDataType type)
{ {
FLAC__ASSERT(is_valid()); 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]) bool Stream::set_metadata_ignore_application(const FLAC__byte id[4])
{ {
FLAC__ASSERT(is_valid()); 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() bool Stream::set_metadata_ignore_all()
{ {
FLAC__ASSERT(is_valid()); 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 Stream::State Stream::get_state() const
@@ -132,37 +132,37 @@ namespace FLAC {
bool Stream::flush() bool Stream::flush()
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_flush(decoder_); return (bool)::FLAC__stream_decoder_flush(decoder_);
} }
bool Stream::reset() bool Stream::reset()
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_reset(decoder_); return (bool)::FLAC__stream_decoder_reset(decoder_);
} }
bool Stream::process_whole_stream() bool Stream::process_whole_stream()
{ {
FLAC__ASSERT(is_valid()); 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() bool Stream::process_metadata()
{ {
FLAC__ASSERT(is_valid()); FLAC__ASSERT(is_valid());
return ::FLAC__stream_decoder_process_metadata(decoder_); return (bool)::FLAC__stream_decoder_process_metadata(decoder_);
} }
bool Stream::process_one_frame() bool Stream::process_one_frame()
{ {
FLAC__ASSERT(is_valid()); 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() bool Stream::process_remaining_frames()
{ {
FLAC__ASSERT(is_valid()); 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) ::FLAC__StreamDecoderReadStatus Stream::read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)

View File

@@ -43,115 +43,103 @@ namespace FLAC {
bool Stream::set_streamable_subset(bool value) bool Stream::set_streamable_subset(bool value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_do_mid_side_stereo(bool value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_loose_mid_side_stereo(bool value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_channels(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_bits_per_sample(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_sample_rate(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_blocksize(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_max_lpc_order(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_qlp_coeff_precision(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_do_qlp_coeff_prec_search(bool value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_do_escape_coding(bool value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_do_exhaustive_model_search(bool value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_min_residual_partition_order(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_max_residual_partition_order(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_rice_parameter_search_dist(unsigned value)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::set_total_samples_estimate(FLAC__uint64 value)
{ {
FLAC__ASSERT(is_valid()); 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()); FLAC__ASSERT(is_valid());
return ::FLAC__stream_encoder_set_seek_table(encoder_, value); return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks);
}
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);
} }
Stream::State Stream::get_state() const Stream::State Stream::get_state() const
@@ -163,19 +151,19 @@ namespace FLAC {
bool Stream::get_streamable_subset() const bool Stream::get_streamable_subset() const
{ {
FLAC__ASSERT(is_valid()); 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 bool Stream::get_do_mid_side_stereo() const
{ {
FLAC__ASSERT(is_valid()); 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 bool Stream::get_loose_mid_side_stereo() const
{ {
FLAC__ASSERT(is_valid()); 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 unsigned Stream::get_channels() const
@@ -217,19 +205,19 @@ namespace FLAC {
bool Stream::get_do_qlp_coeff_prec_search() const bool Stream::get_do_qlp_coeff_prec_search() const
{ {
FLAC__ASSERT(is_valid()); 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 bool Stream::get_do_escape_coding() const
{ {
FLAC__ASSERT(is_valid()); 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 bool Stream::get_do_exhaustive_model_search() const
{ {
FLAC__ASSERT(is_valid()); 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 unsigned Stream::get_min_residual_partition_order() const
@@ -268,13 +256,13 @@ namespace FLAC {
bool Stream::process(const FLAC__int32 *buf[], unsigned samples) bool Stream::process(const FLAC__int32 *buf[], unsigned samples)
{ {
FLAC__ASSERT(is_valid()); 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) bool Stream::process_interleaved(const FLAC__int32 buf[], unsigned samples)
{ {
FLAC__ASSERT(is_valid()); 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) ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data)

View File

@@ -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) 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; 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); FLAC__ASSERT(0 != file);
if(fread(buffer, 1, entry_length_len, file) != entry_length_len) 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; unsigned i;
FLAC__MetaData_SimpleIteratorStatus status; FLAC__MetaData_SimpleIteratorStatus status;
const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; 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); FLAC__ASSERT(0 != file);
if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_(file, &(block->vendor_string)))) 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[10] = (block->sample_rate >> 12) & 0xff;
buffer[11] = (block->sample_rate >> 4) & 0xff; buffer[11] = (block->sample_rate >> 4) & 0xff;
buffer[12] = ((block->sample_rate & 0x0f) << 4) | (channels1 << 1) | (bps1 >> 4); 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); pack_uint32_((FLAC__uint32)block->total_samples, buffer+14, 4);
memcpy(buffer+18, block->md5sum, 16); memcpy(buffer+18, block->md5sum, 16);
@@ -1618,8 +1620,9 @@ FLAC__MetaData_SimpleIteratorStatus write_metadata_block_data_vorbis_comment_(FI
unsigned i; unsigned i;
const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; 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; 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); FLAC__ASSERT(0 != file);
pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len); pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len);

View File

@@ -33,7 +33,7 @@ OBJS= $(C_FILES:.c=.obj)
all: metaflac.exe all: metaflac.exe
metaflac.exe: $(OBJS) 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: clean:
-del *.obj *.pch -del *.obj *.pch

View File

@@ -201,7 +201,7 @@ typedef struct {
unsigned capacity; unsigned capacity;
} args; } args;
unsigned num_files; unsigned num_files;
const char **filenames; char **filenames;
} CommandLineOptions; } CommandLineOptions;
static void die(const char *message); static void die(const char *message);

View File

@@ -61,6 +61,7 @@ FLAC__bool file_utils__change_stats(const char *filename, FLAC__bool read_only)
struct stat stats; struct stat stats;
if(0 == stat(filename, &stats)) { if(0 == stat(filename, &stats)) {
#if !defined _MSC_VER && !defined __MINGW32__
if(read_only) { if(read_only) {
stats.st_mode &= ~S_IWUSR; stats.st_mode &= ~S_IWUSR;
stats.st_mode &= ~S_IWGRP; 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_IWGRP;
stats.st_mode |= S_IWOTH; 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)) if(0 != chmod(filename, stats.st_mode))
return false; return false;
} }