Fixes from upstream:
- Clean up symbol visibility. - Don't force quit in signal handler, since we might double-free things. - Disable reverb flag in modplug decoder. It's producing trash in some cases. - Don't underflow array when parsing timidity config file. - Fix read_config_file() not closing the file when there is an error. - Honor the return code from recursive read_config_file() call. - Reset some state on shutdown to prevent crash when reinitializing. from Brad
This commit is contained in:
parent
eee7df586d
commit
612f280208
@ -1,10 +1,10 @@
|
||||
# $OpenBSD: Makefile,v 1.19 2010/11/15 19:46:09 espie Exp $
|
||||
# $OpenBSD: Makefile,v 1.20 2012/06/01 15:57:51 ajacoutot Exp $
|
||||
|
||||
COMMENT= library that handles the decoding of sound file formats
|
||||
|
||||
DISTNAME= SDL_sound-1.0.3
|
||||
PKGNAME= ${DISTNAME:L:S/_/-/}
|
||||
REVISION= 0
|
||||
REVISION= 1
|
||||
CATEGORIES= devel audio
|
||||
MASTER_SITES= http://offload1.icculus.org/SDL_sound/downloads/
|
||||
|
||||
|
15
devel/sdl-sound/patches/patch-SDL_sound_h
Normal file
15
devel/sdl-sound/patches/patch-SDL_sound_h
Normal file
@ -0,0 +1,15 @@
|
||||
$OpenBSD: patch-SDL_sound_h,v 1.1 2012/06/01 15:57:51 ajacoutot Exp $
|
||||
|
||||
Clean up symbol visibility.
|
||||
|
||||
--- SDL_sound.h.orig Fri Jun 1 02:52:00 2012
|
||||
+++ SDL_sound.h Fri Jun 1 02:52:38 2012
|
||||
@@ -79,6 +79,8 @@ extern "C" {
|
||||
|
||||
#ifdef SDL_SOUND_DLL_EXPORTS
|
||||
# define SNDDECLSPEC __declspec(dllexport)
|
||||
+#elif (__GNUC__ >= 3)
|
||||
+# define SNDDECLSPEC __attribute__((visibility("default")))
|
||||
#else
|
||||
# define SNDDECLSPEC
|
||||
#endif
|
@ -1,7 +1,41 @@
|
||||
$OpenBSD: patch-configure_in,v 1.1 2010/07/25 02:11:14 jolan Exp $
|
||||
$OpenBSD: patch-configure_in,v 1.2 2012/06/01 15:57:51 ajacoutot Exp $
|
||||
|
||||
Clean up symbol visibility.
|
||||
|
||||
--- configure.in.orig Sun Apr 20 16:33:43 2008
|
||||
+++ configure.in Fri Jul 9 18:55:19 2010
|
||||
@@ -222,9 +222,9 @@ AC_ARG_ENABLE(ogg,
|
||||
+++ configure.in Fri Jun 1 02:53:20 2012
|
||||
@@ -58,6 +58,30 @@ AM_PROG_LIBTOOL
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------
|
||||
+dnl Have GCC's -fvisibility option?
|
||||
+dnl ---------------------------------------------------------------------
|
||||
+AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
|
||||
+have_gcc_fvisibility=no
|
||||
+visibility_CFLAGS="-fvisibility=hidden"
|
||||
+save_CFLAGS="$CFLAGS"
|
||||
+CFLAGS="$save_CFLAGS $visibility_CFLAGS"
|
||||
+AC_TRY_COMPILE([
|
||||
+#if !defined(__GNUC__) || __GNUC__ < 4
|
||||
+#error SDL only uses visibility attributes in GCC 4 or newer
|
||||
+#endif
|
||||
+],[
|
||||
+],[
|
||||
+have_gcc_fvisibility=yes
|
||||
+])
|
||||
+AC_MSG_RESULT($have_gcc_fvisibility)
|
||||
+CFLAGS="$save_CFLAGS"
|
||||
+
|
||||
+if test x$have_gcc_fvisibility = xyes; then
|
||||
+ CFLAGS="$CFLAGS $visibility_CFLAGS"
|
||||
+fi
|
||||
+
|
||||
+
|
||||
+dnl ---------------------------------------------------------------------
|
||||
dnl Debug mode?
|
||||
dnl ---------------------------------------------------------------------
|
||||
|
||||
@@ -222,9 +246,9 @@ AC_ARG_ENABLE(ogg,
|
||||
, enable_ogg=yes)
|
||||
if test x$enable_ogg = xyes; then
|
||||
AC_CHECK_HEADER(vorbis/codec.h, have_vorbis_hdr=yes)
|
||||
@ -13,7 +47,7 @@ $OpenBSD: patch-configure_in,v 1.1 2010/07/25 02:11:14 jolan Exp $
|
||||
have_vorbis=no
|
||||
if test x$have_ogg = xyes; then
|
||||
if test x$have_vorbis_hdr = xyes -a x$have_vorbis_lib = xyes; then
|
||||
@@ -259,7 +259,7 @@ AC_ARG_ENABLE(flac,
|
||||
@@ -259,7 +283,7 @@ AC_ARG_ENABLE(flac,
|
||||
, enable_flac=yes)
|
||||
if test x$enable_flac = xyes; then
|
||||
AC_CHECK_HEADER(FLAC/stream_decoder.h, have_flac_hdr=yes)
|
||||
|
14
devel/sdl-sound/patches/patch-decoders_modplug_c
Normal file
14
devel/sdl-sound/patches/patch-decoders_modplug_c
Normal file
@ -0,0 +1,14 @@
|
||||
$OpenBSD: patch-decoders_modplug_c,v 1.1 2012/06/01 15:57:51 ajacoutot Exp $
|
||||
|
||||
Disable reverb flag in modplug decoder. It's producing trash in some cases.
|
||||
|
||||
--- decoders/modplug.c.orig Fri Jun 1 02:57:54 2012
|
||||
+++ decoders/modplug.c Fri Jun 1 02:58:05 2012
|
||||
@@ -128,7 +128,6 @@ static int MODPLUG_init(void)
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
settings.mFlags |= MODPLUG_ENABLE_NOISE_REDUCTION |
|
||||
- MODPLUG_ENABLE_REVERB |
|
||||
MODPLUG_ENABLE_MEGABASS |
|
||||
MODPLUG_ENABLE_SURROUND;
|
||||
|
@ -0,0 +1,30 @@
|
||||
$OpenBSD: patch-decoders_timidity_instrum_dls_c,v 1.1 2012/06/01 15:57:51 ajacoutot Exp $
|
||||
|
||||
Clean up symbol visibility.
|
||||
|
||||
--- decoders/timidity/instrum_dls.c.orig Fri Jun 1 02:53:52 2012
|
||||
+++ decoders/timidity/instrum_dls.c Fri Jun 1 02:54:37 2012
|
||||
@@ -51,9 +51,9 @@ typedef struct _RIFF_Chunk {
|
||||
struct _RIFF_Chunk *next;
|
||||
} RIFF_Chunk;
|
||||
|
||||
-extern DECLSPEC RIFF_Chunk* SDLCALL LoadRIFF(SDL_RWops *src);
|
||||
-extern DECLSPEC void SDLCALL FreeRIFF(RIFF_Chunk *chunk);
|
||||
-extern DECLSPEC void SDLCALL PrintRIFF(RIFF_Chunk *chunk, int level);
|
||||
+extern RIFF_Chunk* LoadRIFF(SDL_RWops *src);
|
||||
+extern void FreeRIFF(RIFF_Chunk *chunk);
|
||||
+extern void PrintRIFF(RIFF_Chunk *chunk, int level);
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -353,8 +353,8 @@ typedef struct _DLS_Data {
|
||||
const char *comments;
|
||||
} DLS_Data;
|
||||
|
||||
-extern DECLSPEC DLS_Data* SDLCALL LoadDLS(SDL_RWops *src);
|
||||
-extern DECLSPEC void SDLCALL FreeDLS(DLS_Data *chunk);
|
||||
+extern DLS_Data* LoadDLS(SDL_RWops *src);
|
||||
+extern void FreeDLS(DLS_Data *chunk);
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
214
devel/sdl-sound/patches/patch-decoders_timidity_timidity_c
Normal file
214
devel/sdl-sound/patches/patch-decoders_timidity_timidity_c
Normal file
@ -0,0 +1,214 @@
|
||||
$OpenBSD: patch-decoders_timidity_timidity_c,v 1.1 2012/06/01 15:57:51 ajacoutot Exp $
|
||||
|
||||
- Don't underflow array when parsing timidity config file.
|
||||
- Fix read_config_file() not closing the file when there is an error.
|
||||
- Honor the return code from recursive read_config_file() call.
|
||||
- Reset some state on shutdown to prevent crash when reinitializing.
|
||||
|
||||
--- decoders/timidity/timidity.c.orig Fri Jun 1 02:58:25 2012
|
||||
+++ decoders/timidity/timidity.c Fri Jun 1 03:05:53 2012
|
||||
@@ -99,13 +99,18 @@ static int read_config_file(char *name)
|
||||
while (RWgets(rw, tmp, sizeof(tmp)))
|
||||
{
|
||||
line++;
|
||||
- w[words=0]=strtok(tmp, " \t\240");
|
||||
+ words=0;
|
||||
+ w[0]=strtok(tmp, " \t\240");
|
||||
if (!w[0]) continue;
|
||||
|
||||
/* Originally the TiMidity++ extensions were prefixed like this */
|
||||
if (strcmp(w[0], "#extension") == 0)
|
||||
- words = -1;
|
||||
- else if (*w[0] == '#')
|
||||
+ {
|
||||
+ w[0]=strtok(0, " \t\240");
|
||||
+ if (!w[0]) continue;
|
||||
+ }
|
||||
+
|
||||
+ if (*w[0] == '#')
|
||||
continue;
|
||||
|
||||
while (w[words] && *w[words] != '#' && (words < MAXWORDS))
|
||||
@@ -208,7 +213,7 @@ static int read_config_file(char *name)
|
||||
if (words < 2)
|
||||
{
|
||||
SNDDBG(("%s: line %d: No directory given\n", name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
for (i=1; i<words; i++)
|
||||
add_to_pathlist(w[i]);
|
||||
@@ -218,13 +223,18 @@ static int read_config_file(char *name)
|
||||
if (words < 2)
|
||||
{
|
||||
SNDDBG(("%s: line %d: No file name given\n", name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
for (i=1; i<words; i++)
|
||||
{
|
||||
+ int status;
|
||||
rcf_count++;
|
||||
- read_config_file(w[i]);
|
||||
+ status = read_config_file(w[i]);
|
||||
rcf_count--;
|
||||
+ if (status != 0) {
|
||||
+ SDL_RWclose(rw);
|
||||
+ return status;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
else if (!strcmp(w[0], "default"))
|
||||
@@ -233,7 +243,7 @@ static int read_config_file(char *name)
|
||||
{
|
||||
SNDDBG(("%s: line %d: Must specify exactly one patch name\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
strncpy(def_instr_name, w[1], 255);
|
||||
def_instr_name[255]='\0';
|
||||
@@ -243,14 +253,14 @@ static int read_config_file(char *name)
|
||||
if (words < 2)
|
||||
{
|
||||
SNDDBG(("%s: line %d: No drum set number given\n", name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
i=atoi(w[1]);
|
||||
if (i<0 || i>127)
|
||||
{
|
||||
SNDDBG(("%s: line %d: Drum set must be between 0 and 127\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
if (!master_drumset[i])
|
||||
{
|
||||
@@ -266,14 +276,14 @@ static int read_config_file(char *name)
|
||||
if (words < 2)
|
||||
{
|
||||
SNDDBG(("%s: line %d: No bank number given\n", name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
i=atoi(w[1]);
|
||||
if (i<0 || i>127)
|
||||
{
|
||||
SNDDBG(("%s: line %d: Tone bank must be between 0 and 127\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
if (!master_tonebank[i])
|
||||
{
|
||||
@@ -289,20 +299,20 @@ static int read_config_file(char *name)
|
||||
if ((words < 2) || (*w[0] < '0' || *w[0] > '9'))
|
||||
{
|
||||
SNDDBG(("%s: line %d: syntax error\n", name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
i=atoi(w[0]);
|
||||
if (i<0 || i>127)
|
||||
{
|
||||
SNDDBG(("%s: line %d: Program must be between 0 and 127\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
if (!bank)
|
||||
{
|
||||
SNDDBG(("%s: line %d: Must specify tone bank or drum set before assignment\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
if (bank->tone[i].name)
|
||||
free(bank->tone[i].name);
|
||||
@@ -316,7 +326,7 @@ static int read_config_file(char *name)
|
||||
if (!(cp=strchr(w[j], '=')))
|
||||
{
|
||||
SNDDBG(("%s: line %d: bad patch option %s\n", name, line, w[j]));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
*cp++=0;
|
||||
if (!strcmp(w[j], "amp"))
|
||||
@@ -326,7 +336,7 @@ static int read_config_file(char *name)
|
||||
{
|
||||
SNDDBG(("%s: line %d: amplification must be between 0 and %d\n",
|
||||
name, line, MAX_AMPLIFICATION));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
bank->tone[i].amp=k;
|
||||
}
|
||||
@@ -337,7 +347,7 @@ static int read_config_file(char *name)
|
||||
{
|
||||
SNDDBG(("%s: line %d: note must be between 0 and 127\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
bank->tone[i].note=k;
|
||||
}
|
||||
@@ -355,7 +365,7 @@ static int read_config_file(char *name)
|
||||
{
|
||||
SNDDBG(("%s: line %d: panning must be left, right, center, or between -100 and 100\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
bank->tone[i].pan=k;
|
||||
}
|
||||
@@ -368,7 +378,7 @@ static int read_config_file(char *name)
|
||||
else
|
||||
{
|
||||
SNDDBG(("%s: line %d: keep must be env or loop\n", name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(w[j], "strip"))
|
||||
@@ -383,19 +393,22 @@ static int read_config_file(char *name)
|
||||
{
|
||||
SNDDBG(("%s: line %d: strip must be env, loop, or tail\n",
|
||||
name, line));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SNDDBG(("%s: line %d: bad patch option %s\n", name, line, w[j]));
|
||||
- return -2;
|
||||
+ goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_RWclose(rw);
|
||||
return 0;
|
||||
+fail:
|
||||
+ SDL_RWclose(rw);
|
||||
+ return -2;
|
||||
}
|
||||
|
||||
int Timidity_Init_NoConfig()
|
||||
@@ -581,6 +594,7 @@ void Timidity_Exit(void)
|
||||
free(e);
|
||||
}
|
||||
free(master_tonebank[i]);
|
||||
+ master_tonebank[i] = NULL;
|
||||
}
|
||||
if (master_drumset[i])
|
||||
{
|
||||
@@ -595,6 +609,7 @@ void Timidity_Exit(void)
|
||||
free(e);
|
||||
}
|
||||
free(master_drumset[i]);
|
||||
+ master_drumset[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
50
devel/sdl-sound/patches/patch-playsound_playsound_c
Normal file
50
devel/sdl-sound/patches/patch-playsound_playsound_c
Normal file
@ -0,0 +1,50 @@
|
||||
$OpenBSD: patch-playsound_playsound_c,v 1.1 2012/06/01 15:57:51 ajacoutot Exp $
|
||||
|
||||
Don't force quit in signal handler, since we might double-free things.
|
||||
|
||||
--- playsound/playsound.c.orig Fri Jun 1 02:55:31 2012
|
||||
+++ playsound/playsound.c Fri Jun 1 02:57:26 2012
|
||||
@@ -312,22 +312,11 @@ void sigint_catcher(int signum)
|
||||
Uint32 ticks = SDL_GetTicks();
|
||||
|
||||
assert(signum == SIGINT);
|
||||
+ if (done_flag < 0)
|
||||
+ return; /* mashing CTRL-C, we get it already. */
|
||||
|
||||
- if ((last_sigint != 0) && (ticks - last_sigint < 500))
|
||||
- {
|
||||
- SDL_PauseAudio(1);
|
||||
- SDL_CloseAudio();
|
||||
- Sound_Quit();
|
||||
- SDL_Quit();
|
||||
- deinit_archive();
|
||||
- exit(1);
|
||||
- } /* if */
|
||||
-
|
||||
- else
|
||||
- {
|
||||
- last_sigint = ticks;
|
||||
- done_flag = 1;
|
||||
- } /* else */
|
||||
+ done_flag = ((last_sigint != 0) && (ticks - last_sigint < 500)) ? -1 : 1;
|
||||
+ last_sigint = ticks;
|
||||
} /* sigint_catcher */
|
||||
#endif
|
||||
|
||||
@@ -1050,12 +1039,15 @@ int main(int argc, char **argv)
|
||||
Sound_FreeSample(sample);
|
||||
|
||||
close_archive(filename);
|
||||
+
|
||||
+ if (done_flag < 0)
|
||||
+ break;
|
||||
} /* for */
|
||||
|
||||
Sound_Quit();
|
||||
SDL_Quit();
|
||||
deinit_archive();
|
||||
- return(0);
|
||||
+ return((done_flag < 0) ? 1 : 0);
|
||||
} /* main */
|
||||
|
||||
/* end of playsound.c ... */
|
Loading…
Reference in New Issue
Block a user