From 189267013e2da0f4f0a14b99874c6e13385e1f34 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Sat, 3 Aug 2002 22:01:35 +0000 Subject: [PATCH] better state reporting --- src/test_libFLAC++/decoders.cc | 30 ++++++++++++++++++++++++------ src/test_libFLAC/decoders.c | 4 ++-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/test_libFLAC++/decoders.cc b/src/test_libFLAC++/decoders.cc index 1242c488..848fada0 100644 --- a/src/test_libFLAC++/decoders.cc +++ b/src/test_libFLAC++/decoders.cc @@ -271,9 +271,11 @@ bool StreamDecoder::die(const char *msg) const State state = get_state(); if(msg) - printf("FAILED, %s, state = %u (%s)\n", msg, (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf("FAILED, %s", msg); else - printf("FAILED, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf("FAILED"); + + printf(", state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); return false; } @@ -945,9 +947,15 @@ bool SeekableStreamDecoder::die(const char *msg) const State state = get_state(); if(msg) - printf("FAILED, %s, state = %u (%s)\n", msg, (unsigned)((::FLAC__SeekableStreamDecoderState)state), state.as_cstring()); + printf("FAILED, %s", msg); else - printf("FAILED, state = %u (%s)\n", (unsigned)((::FLAC__SeekableStreamDecoderState)state), state.as_cstring()); + printf("FAILED"); + + printf(", state = %u (%s)\n", (unsigned)((::FLAC__SeekableStreamDecoderState)state), state.as_cstring()); + if(state == ::FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR) { + FLAC::Decoder::Stream::State state_ = get_stream_decoder_state(); + printf(" stream decoder state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state_), state_.as_cstring()); + } return false; } @@ -1581,9 +1589,19 @@ bool FileDecoder::die(const char *msg) const State state = get_state(); if(msg) - printf("FAILED, %s, state = %u (%s)\n", msg, (unsigned)((::FLAC__FileDecoderState)state), state.as_cstring()); + printf("FAILED, %s", msg); else - printf("FAILED, state = %u (%s)\n", (unsigned)((::FLAC__FileDecoderState)state), state.as_cstring()); + printf("FAILED"); + + printf(", state = %u (%s)\n", (unsigned)((::FLAC__FileDecoderState)state), state.as_cstring()); + if(state == ::FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR) { + FLAC::Decoder::SeekableStream::State state_ = get_seekable_stream_decoder_state(); + printf(" seekable stream decoder state = %u (%s)\n", (unsigned)((::FLAC__SeekableStreamDecoderState)state_), state_.as_cstring()); + if(state_ == ::FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR) { + FLAC::Decoder::Stream::State state__ = get_stream_decoder_state(); + printf(" stream decoder state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state__), state__.as_cstring()); + } + } return false; } diff --git a/src/test_libFLAC/decoders.c b/src/test_libFLAC/decoders.c index d00c164e..fef757ef 100644 --- a/src/test_libFLAC/decoders.c +++ b/src/test_libFLAC/decoders.c @@ -76,7 +76,7 @@ static FLAC__bool die_ss_(const char *msg, const FLAC__SeekableStreamDecoder *de printf(", state = %u (%s)\n", (unsigned)state, FLAC__SeekableStreamDecoderStateString[state]); if(state == FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR) { FLAC__StreamDecoderState state_ = FLAC__seekable_stream_decoder_get_stream_decoder_state(decoder); - printf(" stream decoder state = %u (%s)\n", (unsigned)state, FLAC__StreamDecoderStateString[state_]); + printf(" stream decoder state = %u (%s)\n", (unsigned)state_, FLAC__StreamDecoderStateString[state_]); } return false; @@ -97,7 +97,7 @@ static FLAC__bool die_f_(const char *msg, const FLAC__FileDecoder *decoder) printf(" seekable stream decoder state = %u (%s)\n", (unsigned)state, FLAC__SeekableStreamDecoderStateString[state_]); if(state_ == FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR) { FLAC__StreamDecoderState state__ = FLAC__file_decoder_get_stream_decoder_state(decoder); - printf(" stream decoder state = %u (%s)\n", (unsigned)state, FLAC__StreamDecoderStateString[state__]); + printf(" stream decoder state = %u (%s)\n", (unsigned)state__, FLAC__StreamDecoderStateString[state__]); } }