Patch for SDL_mixer 1.2 (OS X Tiger)


SDL_mixer 1.2 fails to build on OS X Tiger with the following failure:

libtool: compile:  gcc -mcpu=970 -O2 -D_GNU_SOURCE=1 -I/opt/sdl- -D_GNU_SOURCE=1 -D_THREAD_SAFE -Wall -fvisibility=hidden -DHAVE_SIGNAL_H -DHAVE_SETBUF -DHAVE_FORK -DCMD_MUSIC -DWAV_MUSIC -DMID_MUSIC -DUSE_TIMIDITY_MIDI -I./timidity -DUSE_NATIVE_MIDI -I./native_midi -MMD -MT build/native_midi_macosx.lo -c native_midi/native_midi_macosx.c  -fno-common -DPIC -o build/.libs/native_midi_macosx.o
native_midi/native_midi_macosx.c: In function 'native_midi_loadsong_RW':
native_midi/native_midi_macosx.c:204: error: 'song' undeclared (first use in this function)
native_midi/native_midi_macosx.c:204: error: (Each undeclared identifier is reported only once
native_midi/native_midi_macosx.c:204: error: for each function it appears in.)
make: *** [build/native_midi_macosx.lo] Error 1

The fix for this is simple: just change song to reval on line 204.

Here is a patch:

--- native_midi/native_midi_macosx.c.orig	2022-04-03 21:04:20.000000000 -0500
+++ native_midi/native_midi_macosx.c	2022-04-03 21:04:35.000000000 -0500
@@ -201,7 +201,7 @@
      * So, we use MusicSequenceLoadSMFData() for powerpc versions
      * but the *WithFlags() on intel which require 10.4 anyway. */
     # if defined(__ppc__) || defined(__POWERPC__)
-    if (MusicSequenceLoadSMFData(song->sequence, data) != noErr)
+    if (MusicSequenceLoadSMFData(retval->sequence, data) != noErr)
         goto fail;
     # else
     if (MusicSequenceLoadSMFDataWithFlags(retval->sequence, data, 0) != noErr)

Considering that the surrounding code in the other preprocessor cases uses retval, I’d say it is likely that someone refactored this code and simply forgot to update the OS X Tiger preprocessor case.

Jason Pepas