music.c
branchSDL-1.2
changeset 1081 119300487b73
parent 945 c606c85c8863
     1.1 --- a/music.c	Sat Dec 14 18:12:10 2019 +0300
     1.2 +++ b/music.c	Sat Dec 14 18:14:10 2019 +0300
     1.3 @@ -145,9 +145,7 @@
     1.4  static int num_decoders = 0;
     1.5  
     1.6  /* Semicolon-separated SoundFont paths */
     1.7 -#ifdef MID_MUSIC
     1.8  char* soundfont_paths = NULL;
     1.9 -#endif
    1.10  
    1.11  int Mix_GetNumMusicDecoders(void)
    1.12  {
    1.13 @@ -1527,7 +1525,6 @@
    1.14  
    1.15  int Mix_SetSoundFonts(const char *paths)
    1.16  {
    1.17 -#ifdef MID_MUSIC
    1.18  	if (soundfont_paths) {
    1.19  		SDL_free(soundfont_paths);
    1.20  		soundfont_paths = NULL;
    1.21 @@ -1539,26 +1536,24 @@
    1.22  			return 0;
    1.23  		}
    1.24  	}
    1.25 -#endif
    1.26  	return 1;
    1.27  }
    1.28  
    1.29 -#ifdef MID_MUSIC
    1.30  const char* Mix_GetSoundFonts(void)
    1.31  {
    1.32  	const char* force = getenv("SDL_FORCE_SOUNDFONTS");
    1.33  
    1.34  	if (!soundfont_paths || (force && force[0] == '1')) {
    1.35  		return getenv("SDL_SOUNDFONTS");
    1.36 -	} else {
    1.37 -		return soundfont_paths;
    1.38  	}
    1.39 +	return soundfont_paths;
    1.40  }
    1.41  
    1.42  int Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data)
    1.43  {
    1.44  	char *context, *path, *paths;
    1.45  	const char* cpaths = Mix_GetSoundFonts();
    1.46 +	int soundfonts_found = 0;
    1.47  
    1.48  	if (!cpaths) {
    1.49  		Mix_SetError("No SoundFonts have been requested");
    1.50 @@ -1578,12 +1573,11 @@
    1.51  	for (path = strtok_r(paths, ":;", &context); path; path = strtok_r(NULL, ":;", &context)) {
    1.52  #endif
    1.53  		if (!function(path, data)) {
    1.54 -			SDL_free(paths);
    1.55 -			return 0;
    1.56 +			continue;
    1.57  		}
    1.58 +		soundfonts_found++;
    1.59  	}
    1.60  
    1.61  	SDL_free(paths);
    1.62 -	return 1;
    1.63 +	return (soundfonts_found > 0);
    1.64  }
    1.65 -#endif