[Flac-dev] FLAC__stream_decoder_process_single and FLAC__STREAM_DECODER_END_OF_STREAM

Erik de Castro Lopo erikd-flac at mega-nerd.com
Sat Jul 14 02:18:56 PDT 2007


Hi all,

If I have code that does this:

    while (FLAC__stream_decoder_process_single (decoder))
        /* Do something. */ ;

I get an infinite loop. Shouldn't FLAC__stream_decoder_process_single
return false if it gets to FLAC__STREAM_DECODER_END_OF_STREAM?

If so, here's a patch.

Cheers,
Erik


------------------8<------------------8<------------------8<------------------
diff -u -r1.140 stream_decoder.c
--- src/libFLAC/stream_decoder.c        10 Jul 2007 02:08:51 -0000      1.140
+++ src/libFLAC/stream_decoder.c        14 Jul 2007 09:15:01 -0000
@@ -1060,6 +1060,7 @@
                                        return true; /* above function sets the status for us */
                                break;
                        case FLAC__STREAM_DECODER_END_OF_STREAM:
+                               return false;
                        case FLAC__STREAM_DECODER_ABORTED:
                                return true;
                        default:
------------------8<------------------8<------------------8<------------------


-- 
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Python addresses true pseudocode's two major failings: that it
isn't standardized, and it isn't executable."
- Grant R. Griffin  in comp.dsp


More information about the Flac-dev mailing list