[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[fluid-dev] Re: fluid_midi: Bug handling invalid MIDI files

From: Matt Giuca
Subject: [fluid-dev] Re: fluid_midi: Bug handling invalid MIDI files
Date: Sun, 24 Oct 2010 12:30:08 +1100

So this bug (ticket #92) was fixed in r392. There's a slight problem with the fix. In the patch I supplied, I had it "return -1" in the event of no characters being read. Since it's emulating getc, I perhaps should have returned the constant EOF (-1), but since all the calls to this function check using "if (result < 0)", I thought the most appropriate constant to return was the literal -1.

In r392, it was changed to "return FLUID_FAILED". This constant just happens to also be -1 (so it works), but it's the wrong constant. Many FluidSynth functions return FLUID_OK or FLUID_FAILED, and then the call checks "if (result != FLUID_OK)". fluid_midi_file_getc is not such a function. It returns the character as an int, and the calls check "if (result < 0)". If FLUID_FAILED were changed to a different constant, this code would break. Can it be changed to "return -1" or "return EOF"?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]