fix FLAC::Decoder::Stream::finish() to return a bool like its C cousin

This commit is contained in:
Josh Coalson 2006-11-09 06:55:21 +00:00
parent 4c5d485b1d
commit 38bf3e6ca9
3 changed files with 19 additions and 7 deletions

View File

@ -143,7 +143,7 @@ namespace FLAC {
virtual ::FLAC__StreamDecoderInitStatus init(); ///< Seek FLAC__stream_decoder_init_stream()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(); ///< Seek FLAC__stream_decoder_init_ogg_stream()
virtual void finish(); ///< See FLAC__stream_decoder_finish()
virtual bool finish(); ///< See FLAC__stream_decoder_finish()
virtual bool flush(); ///< See FLAC__stream_decoder_flush()
virtual bool reset(); ///< See FLAC__stream_decoder_reset()

View File

@ -53,7 +53,7 @@ namespace FLAC {
Stream::~Stream()
{
if(0 != decoder_) {
::FLAC__stream_decoder_finish(decoder_);
(void)::FLAC__stream_decoder_finish(decoder_);
::FLAC__stream_decoder_delete(decoder_);
}
}
@ -171,10 +171,10 @@ namespace FLAC {
return ::FLAC__stream_decoder_init_ogg_stream(decoder_, read_callback_, seek_callback_, tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this);
}
void Stream::finish()
bool Stream::finish()
{
FLAC__ASSERT(is_valid());
::FLAC__stream_decoder_finish(decoder_);
return (bool)::FLAC__stream_decoder_finish(decoder_);
}
bool Stream::flush()

View File

@ -332,7 +332,11 @@ bool StreamDecoder::test_respond(bool is_ogg)
printf("OK\n");
printf("testing finish()... ");
finish();
if(!finish()) {
State state = get_state();
printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
return false;
}
printf("OK\n");
return true;
@ -414,7 +418,11 @@ bool FileDecoder::test_respond(bool is_ogg)
printf("OK\n");
printf("testing finish()... ");
finish();
if(!finish()) {
State state = get_state();
printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
return false;
}
printf("OK\n");
return true;
@ -714,7 +722,11 @@ static bool test_stream_decoder(Layer layer, bool is_ogg)
}
printf("testing finish()... ");
decoder->finish();
if(!decoder->finish()) {
FLAC::Decoder::Stream::State state = decoder->get_state();
printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring());
return false;
}
printf("OK\n");
/*